chroma
chroma copied to clipboard
Multi-Language highlighting based on filename
What problem does this feature solve?
Template languages like Jinja are languages in languages and they would benefit from highlighting twice: Once for the templated syntax, and once for the template language itself. Requirement for this to work would be the presence of multiple file extensions like nginx.conf.j2.
What feature do you propose?
nginx.conf- First pass, strip the.j2suffix, highlight as nginxnginx.conf.j2- Second pass, highlight as Jinja, retain nginx highlighting
Chroma already supports this in the same way as Pygments does, via a delegating lexer. But I assume what you're proposing is some mechanism by which nested file extensions could be used to do this automatically?
Yes, automatic detection based on filename would be my request in this case.
I suppose not all languages mix well together, so it should only be enabled for known template languages like jinja, handlebars, go template etc.