jekyll-toc
jekyll-toc copied to clipboard
inject_anchors customization feature
I think it would be great to give user an opportunity to customize injected anchors, for example by adding toc-injected-anchors.html template to _includes directory, the content of which will override default string.
I'd specificaly love to be able to at least have a custom class, as i don't use octicons, I use feathericons.
@toshimaru it seems like you intend to do this anyway? https://github.com/toshimaru/jekyll-toc/issues/24#issuecomment-430768347
I've submitted a PR for this feature: https://github.com/toshimaru/jekyll-toc/pull/75 If anyone here is still looking for this, I'd be interested to hear any feedback. Thanks :)
Following up here because I'd like to have this feature as well!
If nothing else, being able to specify a class on the anchor tags would be useful in enabling things like Bootstrap Scrollspy.
The PR above appears to solve this and other problems, though having a config option for the class would still be nice to provide consistency with the custom list item classes.
I'm still considering whether jekyll-toc supports custom anchor feature. I'd like to recommend to use anchor.js. It might be more flexible solution.
Does it sound good to you?
ref. https://www.bryanbraun.com/anchorjs/
Like etsauer mentioned, just having a config option would be really useful if you're trying to maintain the scope of this plugin. Seems like in order to get Bootstrap 4's Scrollspy to work, you really only need '.nav-link' or '.list-group-item' on the TOC anchors.
AnchorJS doesn't seem like it has a graceful way of handling this, but I'm not super familiar
TBH, I'd prefer a solution in the jekyll stage, to minimise in JS - only fuctionality and load times.