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

Incorrect "tag must be paired" message #23

Closed
aroberge opened this issue Apr 8, 2014 · 24 comments
Closed

Incorrect "tag must be paired" message #23

aroberge opened this issue Apr 8, 2014 · 24 comments

Comments

@aroberge
Copy link

aroberge commented Apr 8, 2014

I'm using htmlhint as an extension of the Brackets editor.

In a file, I have an audio tag with a source tag:
[audio id="take-sound" preload]
[source src="src/sounds/pick.wav" type="audio/x-wav"]
[/audio]

I get a "tag must be paired message". In html5, the source tag does not require a closing tag.

It would be useful if htmlhint would allow the insertion of comments within html5 to disable errors, something like

[!-- htmlhint ignore:line --]

EDIT: have replace angle brackets by square brackets, otherwise the entire content inside them disappeared.

@yaniswang
Copy link
Contributor

You can config the htmlhint to disable tag-pair.

https://github.com/yaniswang/HTMLHint/wiki/Usage

@aroberge
Copy link
Author

aroberge commented Apr 9, 2014

tag-pair verification is VERY useful; I do not want to disable it. But the "source" tag, within a pair of "audio" tags, does not need to have a closing tag. Hence, HTMLhint gives a wrong message when the "source" tag is used.

@yaniswang
Copy link
Contributor

I have no solution for this.

HTMLHint only can scan html code.

Do you have some good idea for this?

@aroberge
Copy link
Author

Yes, htmlhint does not flag image or br tags that are not closed, as they do not need to be closed. The source tag should be treated the same way.

@yaniswang
Copy link
Contributor

I just test your code with: http://htmlhint.com/

[audio id="take-sound" preload]
[source src="src/sounds/pick.wav" type="audio/x-wav"]
[/audio]

Only report a Doctype error message.

@aroberge
Copy link
Author

Please remplace the square brackets [ by proper angle brackets

<audio id="take-sound" preload>
    <source src="src/sounds/pick.wav" type="audio/x-wav"> 
</audio>

to see the error. I had used square brackets because I did not realize I needed to indent the code to have angle brackets displayed properly before (and the sample code with angle brackets was not showing).

@yaniswang
Copy link
Contributor

I'm sorry, my english is pool, i can't understand.

is your user defined tag name?

@aroberge
Copy link
Author

No need to apologize. When I reported the bug, I did not understand the commenting system on github.

The html source tag https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source does not need to be closed. Yet, htmlhint identifies this as an error.

@yaniswang
Copy link
Contributor

Ok, I know.
Give me time for this.

@aroberge
Copy link
Author

Ok, thank you very much! :-)

@franz-josef-kaiser
Copy link

@aroberge Point is that you still should use self closing tags: <example />. Not every browser has a HTML5 parser built in.

@darkwebdev
Copy link

Oh come on @franz-josef-kaiser - it's 2014, no one uses xhtml and even old IEs understand unclosed tags.

@yaniswang it would be nice if HTMLHint could ignore a part of html code, something like this:

<div class="not-ignored"></div>
<!-- htmlhint:ignore -->
<div class="ignored"></div>
<!-- /htmlhint:ignore -->
<div class="not-ignored"></div>

that's useful because sometimes we use php with html together and of course sometimes php tags drive HTMLHint crazy

@aroberge
Copy link
Author

@franz-josef-kaiser Given that the non self-closing tag I was using was an HTML5 specific tag, a comment about browsers not supporting this is completely missing the point.

@franz-josef-kaiser
Copy link

@aroberge And how would the Linter know that you are using a HTML5 tag? (rhetorical question)

@aroberge
Copy link
Author

@franz-josef-kaiser Simply adding an option to ignore specific tags by recognizing a specially formed comment like I mentioned when I entered this issue or similarly introduced by @darkwebdev would be all that is needed: this would be future proof for any new html tag.

@yaniswang
Copy link
Contributor

HTMLHint is a html Linter, so i suggest not support other script language, such as:PHP,java,.net,Ruby...
If you want to use HTMLHint, please covert to HTML code first.

@franz-josef-kaiser
Copy link

@yaniswang Yes, but in lots of cases you have templates containing code that converts on runtime. PHP is a templating language and such content can't get converted up front as it's coming from a database..

@yaniswang
Copy link
Contributor

We test the html code on test env in my company.
Get the code with http protocal, output by jboss.

@adarrra
Copy link

adarrra commented Apr 2, 2015

Hi! Why I get error message from this code?
<a role="document" ng-href={{"docs/lic_"+currentLang+".txt"}} target="_blank"> {{'LICENSE' | translate}} </a>

Tag must be paired, No start tag: [ </a> ]

@yaniswang
Copy link
Contributor

HtmlHint only support html code, no support template.

@adarrra
Copy link

adarrra commented Apr 3, 2015

No! Everything ok! I got error because of ng-href={{"docs/lic_"+currentLang+".txt"}}
should be ng-href="{{'docs/lic_'+currentLang+'.txt'}}" (quotes important).
Also, sometime I get such errors because of missing space between attributes.
)

@JegadeeshVontlin
Copy link

@aroberge hey bro, you might have missed the div or any other pair , thats the problem , just now i solved on my own 👍

@jfoclpf
Copy link

jfoclpf commented Sep 23, 2020

@yaniswang please reopen the issue

I get this error on standard HTML5 datalist referring that <option> must be paired, but it does not inside datalist

<label for="myBrowser">Choose a browser from this list:</label>
<input list="browsers" id="myBrowser" name="myBrowser" />
<datalist id="browsers">
  <option value="Chrome">
  <option value="Firefox">
  <option value="Internet Explorer">
  <option value="Opera">
  <option value="Safari">
  <option value="Microsoft Edge">
</datalist>

@dphillips479
Copy link

I'm working a lot with TYPO3 and some of it's viewhelpers chain arguments separated by dots in the tag name. This will throw an error:

<f:link.page>
  some text
</f:link.page>

It would be nice if HtmlHint would let the . slide and I wouldn't have to deactivate tag-pair completely. I know these aren't standard tags. But it would be nice to have an option for these cases.

I would change the rule and load it as a custom one, but I'm not sure how I can make it ignore the dot.

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

No branches or pull requests

9 participants