Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.
import { MarkdownHeading, MarkdownVFile } from '@astrojs/markdown-remark';
import { jsToTreeNode } from './utils.js';
export function rehypeInjectHeadingsExport() {
return function (tree: any, file: MarkdownVFile) {
const headings: MarkdownHeading[] = file.data.__astroHeadings || [];
tree.children.unshift(
jsToTreeNode(`export function getHeadings() { return ${JSON.stringify(headings)} }`)
);
};
}