2022-05-24 22:03:29 +00:00
|
|
|
import { mdxjs } from 'micromark-extension-mdxjs';
|
|
|
|
import { mdxFromMarkdown, mdxToMarkdown } from './mdast-util-mdxish.js';
|
2022-05-24 22:02:11 +00:00
|
|
|
|
|
|
|
export default function remarkMdxish(this: any, options = {}) {
|
2022-05-24 22:03:29 +00:00
|
|
|
const data = this.data();
|
2022-05-24 22:02:11 +00:00
|
|
|
|
2022-05-24 22:03:29 +00:00
|
|
|
add('micromarkExtensions', mdxjs(options));
|
|
|
|
add('fromMarkdownExtensions', mdxFromMarkdown());
|
|
|
|
add('toMarkdownExtensions', mdxToMarkdown());
|
2022-05-24 22:02:11 +00:00
|
|
|
|
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);
|
|
|
|
}
|
2022-05-24 22:02:11 +00:00
|
|
|
}
|