Skip to content

feat: Improve syntax highlighting support for template languages, such as Tera #13549

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

nik-rev
Copy link
Contributor

@nik-rev nik-rev commented May 17, 2025

Template languages like Tera can be used for any language at all. They can generate JavaScript, Rust, HTML or Markdown.

That's great! But it makes syntax highlighting for these languages harder than any other. You usually have to make a dedicated grammar for each language combination, like html-tera, css-tera, js-tera etc.

With this PR, it's all in a much better position now! The language injected will be based off the file name. That is, if you have a file like index.html.tera, it will inject the html language. If you have index.css.tera, it injects css. It simply uses the 2nd extension.

What this means is that, we can basically support all template languages with any possible language that they template for.

This PR depends on this PR to tree-house

Before

image

After

image

@nik-rev nik-rev changed the title feat: (massively!) Improve syntax highlighting support for template languages, such as Tera feat: Improve syntax highlighting support for template languages, such as Tera May 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant