codeblog-mdx-to-mdx-ast
v3.0.0
Published
**This is a fork of https://github.com/devular/mdx-to-mdx-ast.**
Downloads
6
Readme
MDX to MDX AST
This is a fork of https://github.com/devular/mdx-to-mdx-ast.
Hello there,
This library was written for educational purposes.
It exports one async function
that takes an MDX string and returns an MDXAST spec tree.
Here is the spec: https://github.com/mdx-js/specification
Why?
- The official MDX package does not export a method for generating an MDXAST spec tree
- The official MDX package uses regexes and assumptions around remark parsing of HTML to specifify JSX, import, and export nodes
- I wanted to use Acorn to verify JSX nodes and esSytax nodes on the tree
- For fun and learning
Running
yarn install && yarn test
to run the package against test/fixture.mdx
Notes
- The EsSyntax tokenizer is taken straight from the MDX-JS/MDX library.
- Tests to come