alohaas / language-nunjucks

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

Syntax highlighting in raw #33

Open ghost opened 6 years ago

ghost commented 6 years ago

Not sure if I'm barking up the wrong tree so I apologise in advance.

When writing templates to be used by front-side JS, I use raw tags. Problem is, syntax highlighting is all grey for text in them. Would it possible to tell language-nunjucks or Atom of the grammar inside raw tags? Perhaps with a comment hint?

Something like this:


      {# HTML #}
      {% raw %} 

        <table>

          <thead>
            <tr>
              <th>Title</th>
            </tr>
          </thead>

          <tbody>
            <tr v-for="carrier in carriers">
              <td>{{ carrier.title }}</td>
            </tr>
          </tbody>

        </table>

      {% endraw %}
revelt commented 6 years ago

It's a right tree! 👍

I'd love that too! I just checked the jinja on atom-jinja2, it's also grey there.

If I had full control over how raw is displayed, I'd definitely syntax-highlight the code but also highlight the {% raw %} markers to the brightest colour available.

Having said that, it's pretty much DIY, very little hope that somebody will come in and implement this. We (me, you, reader) would have to do it ourselves.

Personally, I've got way more important OS projects brewing, but with regards to Nunjucks, linter would be my top priority if I started tinkering on Nunjucks tooling.

alohaas commented 6 years ago

Thanks for this suggestion! I've been working with handlebars lately, but a project with nunjucks just came back around so I may have some time to look into this next week.