5

I have a problem with jinja2 highlighter in sublime 3.All the files associated with .html extensions don't recognize jinja templates blocks..I searched the web but the only solution I found is to make a .jinja.html custom extension..anyone got any idea how to solve this?..This is the plugin I installed https://packagecontrol.io/packages/Jinja2

kanelloc
  • 177
  • 3
  • 15
  • If it isn't a true html file, why is the extension `.html`? Do you know what extension that plugin is associated with? Do you really need the syntax highlighting to be automatic? – OneCricketeer Oct 16 '16 at 20:06
  • And, if you see the comments on this post. "There are two modes: Jinja Templates and HTML (Jinja Templates). The latter is a full HTML mode plus Jinja syntax" http://stackoverflow.com/questions/22870627/sublime-text-syntax-highlight-jinja2 – OneCricketeer Oct 16 '16 at 20:10
  • if one want to edit css file with jinja, try swapping the sublime text syntax highlighting to "sass" – enthus1ast Jun 18 '17 at 01:51

1 Answers1

8

You need to add .j2 to your file extension:

mysupertemplate.html.j2

Have a look at the syntax file (under fileTypes)

math2001
  • 4,167
  • 24
  • 35
  • 4
    I found out that there are 2 ways.The first is as math told above to add a .j2 extension in the html file and the other to ctrl+swift+p in sublime and SET syntax to HTML(jinja2).Thank you verry much – kanelloc Oct 17 '16 at 10:26