One of the reasons I don't like "Plain Text" is that you have to do this fucking trickery to get any useful syntax tree out of it:
https://blog.pulsar-edit.dev/posts/20231110-savetheclocktower-modern-tree-sitter-part-5/#markdown-and-front-matter
or just™ use regexp and get it working 60% of the time (e.g. as most language modes do in #emacs, or filetype's -syntax were in #vim).
P.S. Parsing with grammars (+nested grammars injections) is much more reliable than regexps, but still have a number of edge cases, where it fails.
https://blog.pulsar-edit.dev/posts/20231110-savetheclocktower-modern-tree-sitter-part-5/#markdown-and-front-matter
or just™ use regexp and get it working 60% of the time (e.g. as most language modes do in #emacs, or filetype's -syntax were in #vim).
P.S. Parsing with grammars (+nested grammars injections) is much more reliable than regexps, but still have a number of edge cases, where it fails.
1