alohaas / language-nunjucks

Syntax highlighting for nunjucks templates in atom.
MIT License
42 stars 13 forks source link

Nunjucks should have priority over HTML #21

Open code-tree opened 7 years ago

code-tree commented 7 years ago

image

Syntax highlighting doesn't work when brackets are inside an opening tag or its attributes.

(nunjucks syntax is highlighted as red)

alohaas commented 7 years ago

Hey @code-tree thanks for the suggestion. I need to ask a clarifying question before making any conclusions or changes. Here's what I'm interpreting from your comment:

You would prefer that nunjucks inserted as html attributes be visually different from other, non-nunjucks html attributes. In other words, using your example, you want'description' and {{ desc }} rendering in different colors. One final question – are you imagining that {{ title }} and {{ desc }} should render in the same color?

code-tree commented 7 years ago

Yes, that's correct to both. As currently, it seems as though the value in content="{{ desc }}" is simply a static string, when in fact it will be replaced by nunjucks.

I assume this is just a matter of giving nunjucks grammar priority over the html grammar, but I wasn't sure how to do that.

alohaas commented 7 years ago

Looking into this today.

revelt commented 6 years ago

This is a biggie.. Currently good part of syntax highlighting does not happen because of this. For example, this is very apparent when coding inline HTML:

inline-nunjucks

I came here investigating what could be done enable proper syntax highlighting.