astro/packages/markdown/remark/src/remark-mdxish.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
496 B
TypeScript
Raw Normal View History

2022-05-24 22:03:29 +00:00
import { mdxjs } from 'micromark-extension-mdxjs';
import { mdxFromMarkdown, mdxToMarkdown } from './mdast-util-mdxish.js';
export default function remarkMdxish(this: any, options = {}) {
2022-05-24 22:03:29 +00:00
const data = this.data();
2022-05-24 22:03:29 +00:00
add('micromarkExtensions', mdxjs(options));
add('fromMarkdownExtensions', mdxFromMarkdown());
add('toMarkdownExtensions', mdxToMarkdown());
2022-05-24 22:03:29 +00:00
function add(field: string, value: unknown) {
const list = data[field] ? data[field] : (data[field] = []);
list.push(value);
}
}