Update MDX, support version 1 and 2, as well as the multiple ASTs generated#689
Update MDX, support version 1 and 2, as well as the multiple ASTs generated#689ChristianMurphy wants to merge 4 commits intofkling:masterfrom
Conversation
mdx version 1 and version 2 have different syntax tree, this allows both versions' syntax trees to be previewed. In addition, mdx internally uses multiple syntax trees. Version 1 has a markdown AST (mdast/remark) and an HTML AST (hast/rehype). Version 2 has a markdown AST (mdast/remark), an HTML AST (hast/rehype), and a JavaScript AST (esast/recma). This updates AST Explorer to have a preview for all version 1 and version 2 ASTs. As well as updates transformers to allow for transforms on both version 1 and version 2.
remcohaszing
left a comment
There was a problem hiding this comment.
Thanks! I really love astexplorer, but I miss MDX2 support
|
Any reason the old AST is still around? Why not drop it? |
|
I also wouldn't mind dropping the old AST |
A couple reasons.
I'd also be fine with dropping it, but defaulted to keeping it. |
|
Re 2: Old versions seems to be around to support old snippet links, they seem to be hidden: fad47c2 Re 1: MDX 0 and 1 ASTs, IMO, are more the “absence” of an AST. It’s mdast, but replaces a |
|
I suppose MDX 3 should be added by now too. |
mdx version 1 and version 2 have different syntax trees, this PR allows both versions' syntax trees to be previewed.
In addition, mdx internally uses multiple syntax trees.
Version 1 has:
Version 2 has:
This updates AST Explorer to have a preview for all version 1 and version 2 ASTs.
As well as updates transformers to allow for transforms on both version 1 and version 2.
This also adds support for syntax extensions, supported in MDX version 2; including GFM, Math, Directives, and more.
/cc @silvenon, @remcohaszing, @wooorm
Screenshots
mdx 2 preview with mdx 2 transformer

parser list for mdx

mdx 2 settings/plugins
