@mintlify/scraping
Version:
Scrape documentation frameworks to Mintlify docs
23 lines • 742 B
JavaScript
import { visit } from 'unist-util-visit';
export function remarkRemoveBottomMetadata() {
return function (root) {
return removeBottomMetadata(root);
};
}
function removeBottomMetadata(root) {
if (root.children.at(-1)?.type === 'thematicBreak') {
root.children.pop();
}
if (root.children.at(-1)?.type === 'paragraph') {
let shouldDelete = false;
visit(root, 'text', function (node) {
if ((node.value.startsWith('Updated') || node.value.startsWith('Last updated')) &&
node.value.endsWith('ago')) {
shouldDelete = true;
}
});
if (shouldDelete)
root.children.pop();
}
}
//# sourceMappingURL=metadata.js.map