-
-
Notifications
You must be signed in to change notification settings - Fork 122
support frontmatter syntax #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
7c84e28
to
ca8c8e5
Compare
This PR is also integrated in the |
I suggest making the "Info String" a separate node, similar to how it is in markdown. so you can match against it like (info_string "yaml") To inject the "yaml" language for example. |
that is actually surprisingly hard, as that is whitespace-sensitive (a Line 64 in 3691201
i have a kinda-working prototype, but that one doesn't work for incremental parsing. i'll try again later to get it actually working, but don't get your hopes up lol. |
4e2ca20
to
5bfaa1a
Compare
5bfaa1a
to
162345d
Compare
@nik-rev went back to this to parse the info string, and it turns out this wasn't actually that hard, it was just a pretty hard skill issue on my side lmao. |
162345d
to
abf0c91
Compare
fixes #253
fixes #224
this parses rust frontmatter as specified in rfc 3503. like with raw strings (which this implementation takes quite a bit of inspiration from), the frontmatter content is parsed as a seperate node
(frontmatter_content)
to allow, for example, to add a toml language injection for the content.i had to do a little hack because of tree-sitter automatically stripping all whitespace, meaning that i cannot always rely on having a newline before the ending fence. this means that it will incorrectly parse some things, but i think those are edge cases that are acceptable, because i couldn't figure out a way to make it stop stripping all whitespace between
_frontmatter_start
andfrontmatter_content
(which is also the cause for #251):no diff for rustc tests as rustc support for it is not yet merged.