question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Looking for double quotes inside Jinja tags

See original GitHub issue

Hi, thanks for the excellent tool! When running on Jinja2 templates it generally works pretty well. However, when there is an if statement inside a tag this error comes up -

image

The html is:

<!DOCTYPE HTML>
<option value="{{ t.id }}" {% if t.id == s.type_id %}selected{% endif %}>{{ t.name }}</option>

and run htmlhint:

npx htmlhint test.html

Is there a way that at htmlhint can ignore what is inside a {% ... %} and {{ ... }} ?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
ckotcommented, Feb 9, 2021

Great tool, and ditto on a request for this feature. I’m using nunjucks templates, which is basically the same syntax as jinja. Although I’m wondering if it might be better to add to the rc file definition some sort of way to express file-extension-specific overrides, for example something like:

fileTypeOverrides: {
    fileExtension: ".njk",
    ignoreBetween: [{
        start: "{%", 
        end: "%"
    }, {
       start: "{{",
       end: "}}"
    }],
    extraRules: [] // for example in templates I might want do disable missing doctype tag as these are merely html snippets....
  }

anyway, just my two cents. I figure that might make it easier to support all sorts of html template syntaxes.

1reaction
christopherpickeringcommented, Jun 18, 2021

asdf

Read more comments on GitHub >

github_iconTop Results From Across the Web

Escaping quotes in jinja2 - python - Stack Overflow
Jinja2 has nice filter tojson. If you make json from string, it will generate string enclosed in double quotes "". You can safely...
Read more >
Jinja2 converting double quotes to single quotes
I've tried various ways of quoting, both in the template and in values.json. Sample hitting the issue: output.json: {. "keepDoubleQuotes ...
Read more >
Inserting Jinja variable into a quoted string - Server Fault
The combination {% opens a Jinja statement. To avoid this interpretation put the brace into a variable, e.g.. BR: '{{ "{" }}'. and...
Read more >
Why do I need to quote column names in Jinja?
We have to use quotes to pass the string 'amount' to the macro. Without the quotes, the Jinja parser will look for a...
Read more >
Template Designer Documentation - Jinja
You can mess around with the variables in templates provided they are passed in by the ... Additionally, the attr() filter only looks...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found