I would like for the Jinja2 package's syntax support to be provided automatically to files with the .html
extension, given that the appropriate delimiters ({% .. %}
, {{ .. }}
) are detected.
I understand this would work for files with the .j2
extension. I am asking if it could be applied to plain HTML files that include Jinja2 syntax, without having to add the entire .html
file type (which would then apply it to any HTML file)?
For now, I have been selecting the HTML (Jinja2)
option from the syntax definition dropdown menu for each file, obviously not an ideal solution.
The easiest way to do this is to open a .html
file, then select View → Syntax → Open all with current extension as… → HTML (Jinja2)
. This should do the trick. If not, there's a different way that involves writing a plugin, but this should be sufficient.
This still works based on the file's extension. However, highlighting of non-template content should be exactly the same as if you were using the regular HTML syntax.