DEV Community

hikerpig
hikerpig

Posted on • Updated on

Toc Bar, table of content for dev.to, finally.

Toc Bar is a userscript I wrote to add floating widget displaying table of content of current page.

Currently only tailored for some personal most-visited sites, including dev.to .

✨Features

  • Use tocbot for toc generation.
  • For some sites, there are no ids on header elements so it would be impossible to navigate by clicking the toc link. Toc Bar will generate ids - which are derived from a simple hash of the header textContent, and prefixed with tocbar- - for these headers.
  • A toggle button is offered, if you don't want toc bar to cover current page content.
  • For some sites in SPA mode, if you navigate to another article, there is no easy way detecting url change in userscript, so I add a refresh button to refresh TOC contents.

Screenshots

devto

Top comments (0)