to-mdxast
Transforms MDAST to MDXAST.
Installation
npm i -S mdast-util-to-mdxast
Usage
const unified = const remark = const inspect = const toMAST = const getImports = const MDX = `import { Foo } from 'bar' # Hello, world! <Foo />` // Import scope must be passed to the remark// parser for block parsingconst options = blocks: blocks const tree = const mdxast = tree console
Output
root[3] (1:1-7:1, 0-53)
├─ import: "import { Foo } from 'bar'" (2:1-2:26, 1-26)
├─ heading[1] (4:1-4:16, 28-43) [depth=1]
│ └─ text: "Hello, world!" (4:3-4:16, 30-43)
└─ jsx: "<Foo />" (6:1-6:8, 45-52)