toshimaru / jekyll-toc

Jekyll plugin which generates a table of contents.
MIT License
340 stars 52 forks source link

`inject_anchors` generates empty links #175

Open anthonydillon opened 11 months ago

anthonydillon commented 11 months ago

The empty links generated by inject_anchors cause accessibility issues. Reference.

Currently the markup results in:

<h2 id="heading-one">
  <a class="anchor" href="#heading-one" aria-hidden="true">
    <span class="octicon octicon-link"></span>
  </a>
  Heading one
</h2>

I would suggest this would be better:

<h2 id="heading-one">
  <a class="anchor" href="#heading-one" aria-hidden="true">
    <span class="octicon octicon-link">Link to Header one section</span>
  </a>
  Heading one
</h2>

The content within the icon is hidden by default.