mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
ff31a5b555
This reverts commit 7a07b128d1
.
20 lines
593 B
JavaScript
20 lines
593 B
JavaScript
const JsonML = require('jsonml.js/lib/utils');
|
|
|
|
module.exports = (markdownData) => {
|
|
const contentChildren = JsonML.getChildren(markdownData.content);
|
|
const apiStartIndex = contentChildren.findIndex((node) => {
|
|
return JsonML.getTagName(node) === 'h2' &&
|
|
JsonML.getChildren(node)[0] === 'API';
|
|
});
|
|
|
|
if (apiStartIndex > -1) {
|
|
const content = contentChildren.slice(0, apiStartIndex);
|
|
markdownData.content = ['section'].concat(content);
|
|
|
|
const api = contentChildren.slice(apiStartIndex);
|
|
markdownData.api = ['section'].concat(api);
|
|
}
|
|
|
|
return markdownData;
|
|
};
|