Skip to content
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

feature: frontmatter #224

Open
1 task done
jwnrt opened this issue May 5, 2024 · 0 comments
Open
1 task done

feature: frontmatter #224

jwnrt opened this issue May 5, 2024 · 0 comments

Comments

@jwnrt
Copy link
Contributor

jwnrt commented May 5, 2024

Did you check the tree-sitter docs?

Is your feature request related to a problem? Please describe.

Rust now supports frontmatter blocks in nightly. See RFC 3503.

These blocks are similar to markdown's fenced code blocks but using dashes instead of backticks.

They're opened with a line of 3+ dashes and an optional infostring, i.e. matching /^-{3,}\s*([^\s,]+)?\s*$/ (for example ---, -----, or --- cargo).

The blocks may contain any characters including dashes.

They are closed by a line matching /^-{n}\s*$/ where n is the number of opening dashes. That will need to be done in scanner.c.

Describe the solution you'd like

Something to match these frontmatter blocks and highlight them as a comment would be nice.

In the future the contents will probably want to be parsed with a language injection depending on the value of the infostring (e.g. TOML for cargo) but I don't think all of that is worked out on the Rust side yet.

Describe alternatives you've considered

An alternative is to just not implement this. It's still unstable.

Additional context

https://rust-lang.github.io/rfcs/3503-frontmatter.html#reference-level-explanation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant