How do I get started with extending Markdown and JavaScript syntaxes?

:wave: I’m new to CodeMirror 6 and want to extend both Markdown and JavaScript with different features.

I’ve done this in tree-sitter-javascript here: Support <template> tags for Glimmer by NullVoxPopuli · Pull Request #208 · tree-sitter/tree-sitter-javascript · GitHub

But in some browsing of lezer/markdown, it seems these parsers are very… position / character-index oriented? Seems kinda intimidating, coming from tree-sitter’s grammar files (JS, but without caring for index / positional information).

The javascript grammar looks much more approachable – tho, I don’t know how to “do anything” with this .grammar file. Is there a tutorial?

Also, would I have to totally replace javascript (to do similar changes to what I did to tree-sitter) – or should I PR to the lezer javascript grammar?

I also need to create a new grammar – Is the .grammar file the way to go? how is that turned into a parser for codemirror? (and then how can I interlace it with markdown? (aka MDX style (though, I’m not doing MDX specifically))).

Thanks!