github-flavored-markdown-to-html
github-flavored-markdown-to-html copied to clipboard
don't create duplicate ids for header items
When the pass of the html is made for "add correct id to all headings" it duplicates the id used on the anchor tag and uses that in the heading tag. This results in a duplicate id which is invalid HTML (and specifically for my interest, fails accessibility standards WCAG 2.2 success criterium 4.1.1 - parsing). An example of the generated duplicate id in the header tag is
<h1 id="user-content-converting-markdown-to-html">
<a
aria-hidden="true"
class="anchor"
href="#user-content-converting-markdown-to-html"
id="user-content-converting-markdown-to-html"
name="user-content-converting-markdown-to-html">
<span aria-hidden="true" class="octicon octicon-link"></span>
</a>
Converting markdown to HTML
</h1>
Bypassing "add correct id to all headings" results in
<h1>
<a
aria-hidden="true"
class="anchor"
href="#user-content-converting-markdown-to-html"
id="user-content-converting-markdown-to-html"
name="user-content-converting-markdown-to-html">
<span aria-hidden="true" class="octicon octicon-link"></span>
</a>
Converting markdown to HTML
</h1>