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

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