I only ask be cause my SE app on my phone colorizes Twig syntax nicely, and I think that it would probably be a good idea to turn it on the main website if possible.



For now, I've enabled this for , and . It can be expanded to more tags if need-be, or even enabled for all tags by default.

Note that you can trigger highlighting for any code block regardless of tag by using the formatting hints.

  • Thanks! I already noticed ))
    – nicael
    Jun 16 '14 at 20:33
  • 3
    Thanks for turning this on. In case it helps anyone, the snippet to use to trigger Twig syntax highlighting on a code block is <!-- language: lang-twig --> Jun 23 '14 at 13:45
  • 1
    I lean toward enabling globally by default, though. Jun 23 '14 at 13:46
  • If you think it should be enabled globally, propose a separate feature-request, @Alex - there are some sanity-checks y'all will want to perform first, most notably making sure that this isn't going to screw up existing posts or catch new users unaware.
    – Shog9
    Jul 12 '14 at 3:10
  • Thanks @Shog9. I actually don't anymore having seen the Twig formatting applied to some non-twig code. Probably best to be triggered manually. Jul 14 '14 at 1:44
  • Hi @Shog9... There has been some confusion regarding the Twig syntax highlighting on the Craft SE site. I've been investigating this thoroughly, and it doesn't look like Google Code Prettify supports Twig... Can you please clarify how (or if) you were able to specify Twig syntax highlighting for "twig" tags?
    – Lindsey D Mod
    Jul 29 '14 at 17:06
  • @AlexKendrick, you give an example of specifying Twig for a code block (lang-twig)... Did you see that referenced somewhere specifically, or did you infer it from the general markup structure?
    – Lindsey D Mod
    Jul 29 '14 at 21:00
  • If memory serves, I inferred it from this post: meta.stackexchange.com/questions/184108/… Jul 29 '14 at 21:46
  • 1
    @AlexKendrick Ah ok, that's what I suspected... I've done some research, and I don't think that Twig syntax highlighting is a real thing. I've detailed my findings here...
    – Lindsey D Mod
    Jul 29 '14 at 22:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .