Open ChristianMurphy opened 1 year ago
Any reason the old AST is still around? Why not drop it?
I also wouldn't mind dropping the old AST
Any reason the old AST is still around? Why not drop it?
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: https://github.com/fkling/astexplorer/commit/fad47c2a66c302f3a10361b11aad1a36703cd72d
Re 1: MDX 0 and 1 ASTs, IMO, are more the “absence” of an AST. It’s mdast, but replaces a html
node with a jsx
node, with a slightly different regex. And it adds import
/export
nodes, which are similarly strings, with different regexes.
I don’t think it’s very interesting to look at this AST. Now that there are nodes for things in v2, I do think it gets interesting, and we could start versioning to keep snippet links alive?
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