Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to disable htmllint completely for a block of code #198

Closed
pdehaan opened this issue Jun 21, 2017 · 1 comment
Closed

Add ability to disable htmllint completely for a block of code #198

pdehaan opened this issue Jun 21, 2017 · 1 comment

Comments

@pdehaan
Copy link

pdehaan commented Jun 21, 2017

I have the following block of code, but it seems like HTMLLint really doesn't like that handlebars partials and throws an error:

<!DOCTYPE html>
<html>
<head>
  <title>Firefox Fileshare</title>
  <script src="/webcrypto-shim.js"></script>
  <script src="/bundle.js"></script>
  <link rel="stylesheet" href="https://code.cdn.mozilla.net/fonts/fira.css" />
  <link rel="stylesheet" type="text/css" href="/main.css" />
  {{#if shouldRenderAnalytics}}
    {{> analytics trackerId=trackerId}}
  {{/if}}
</head>
...

And the error is:

> htmllint 'views/*.handlebars'

views/download.handlebars: line 3, col 7, text contains improperly escaped characters:

Where line 3 is the opening <head> tag. I think it really hates that non-HTML {{> analytics trackerId=trackerId}} bit. I was hoping there was some inline config like <!-- htmllint disable -->...<!-- htmllint enable --> which would toggle off all rules. I see there may be some preset trickery I could try, but I can't seem to get it to work locally where I ignore all rules for a few specific lines and then revert back to my original config.

@mlochbaum
Copy link
Member

The line and column numbers should now be accurate; see #205. Other than that, the error message is correct, strictly speaking...

You should be able to disable all rules with <!-- htmllint preset="none" --> but this is crashing for me when I try it on your example. It works in the unit tests. There is not an easy way to revert it either, and it doesn't prevent the parser from getting in a bad state because of invalid html between that and the next comment tag.

See #155 for my discussion on how to add an option to ignore these kinds of tags. I'm closing this as a duplicate of #155, but fixing that issue somehow is my top priority for htmllint right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants