[html] HTML breadcrumbs don't work right when optional end tags omitted
See original GitHub issue- VSCode Version: 1.42.0-insider
- OS Version: Linux Mint 19.3
Steps to Reproduce:
- Create an HTML document. Sprinkle liberally with
<p>
,<li>
(inside of<ul>
or<ol>
, obviously),<tr>
or<td>
inside of<table>
, and any other elements noted in the HTML5 spec as having optional end tags (see https://html.spec.whatwg.org/#syntax-tag-omission). - If you closed the various tags above with their end tags (e.g.,
</p>
), then run the page through something like HTML Tidy (I am using v5.7.28), passing in the--omit-optional-tags yes
argument. - Open the reformatted file in VSCode and navigate somewhere where there are multiple
<p>
or<li>
or similar in a row. Note that there will be a breadcrumb for each open tag, because VSCode is apparently looking for end tags to close off the element, even though it is not required.
In a complex document, this make VSCode breadcrumbs pretty worthless. Here is an example, before a Tidy reformat, with focus on the third list item element in the fourth paragraph (note breadcrumbs working as expected):
And here are the breadcrumbs after the Tidy reformat, with focus on the same list item element:
Does this issue occur when all extensions are disabled?: Yes
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Omitting optional tags of html - Stack Overflow
If you use HTML 4 transitional, then yes, you're fine leaving off end tags. If you use XHTML or HTML 4 strict, then...
Read more >Handling common HTML and CSS problems - MDN Web Docs
Some problems can be solved by just taking advantage of the natural way in which HTML/CSS work. Unrecognized HTML elements are treated by...
Read more >Restrict filters and breadcrumbs with fixed queries
You can use a script to restrict filters and breadcrumbs to specific roles, either on a per-table or global basis. Using a script...
Read more >WordPress Breadcrumbs: How to Enable Them on Your ...
On the left side, right below the header, you can see the words Home > Resource Center > Kinsta Blog. Each is a...
Read more >Optional closing tags in HTML - tempertemper
There's a relatively short list of elements you can do this with. So you could come a cropper by omitting the closing tag...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
v1.11.0 of js-beautify fixes the formatting issue that @nikeee commented on. This doesn’t fix the breadcrumb issue.
Related issue in https://github.com/microsoft/vscode-html-languageservice/issues/63
@bitwiseman Sorry for only see your question now. Yes, that needs to go into the HTML parser. If you want to give it a try, that would be fantastic.