Repository navigation
syntax: add Jinja2 template syntax highlighting - #5171
KuzinAndrey wants to merge 1 commit into
Conversation
zyv
left a comment
There was a problem hiding this comment.
I like that, but I'm wondering if everybody will like that. It is often the case that the .j2 extension is used on top of YAML, HTML, Python, etc. Because our CoolEdit highlighter doesn't support composed syntaxes, these files will not be highlighted as these languages before.
On the other hand, I think right now they are simply not highlighted at all, and so this is an improvement. If the user wants to force a different highlighting, mcedit allows you to change the syntax on the fly.
Add jinja2.syntax for Jinja2 templates (*.j2, *.jinja, *.jinja2):
{% %} statement and {{ }} expression tag contexts, {# #} and #
comments, strings, numbers, operators and literals, with every builtin
filter, test and global function colored as a builtin name per
https://jinja.palletsprojects.com/en/stable/templates/.
Signed-off-by: Kuzin Andrey <kuzinandrey@yandex.ru>
426cf88 to
2bdc841
Compare
|
Yes, currently there is no syntax highlighting at all for such files. However, embedded highlighting needs to be supported within other syntax files for Yaml, Html, Python. Also improved the syntax highlighting of floating-point numbers written in exponential notation. |
If by that you mean that you intend to add J2 inside other highlighters, then I don't think it's a good idea. I would rather leave it to one day in the future when we have an alternative engine. |
No, only what has already been done for support .j2/.jinja in that PR. I meant that partial syntax highlighting is already supported in some files for Jinja templates (yaml for example) |
Proposed changes
Add jinja2.syntax for Jinja2 templates (*.j2, *.jinja, *.jinja2)
Checklist
git commit --amend -smake indent && make check)