jekyll-toc icon indicating copy to clipboard operation
jekyll-toc copied to clipboard

inject_anchors customization feature

Open SpaceOyster opened this issue 7 years ago • 9 comments

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.

SpaceOyster avatar Jan 16 '18 08:01 SpaceOyster

I'd specificaly love to be able to at least have a custom class, as i don't use octicons, I use feathericons.

JadedBlueEyes avatar Dec 14 '18 20:12 JadedBlueEyes

@toshimaru it seems like you intend to do this anyway? https://github.com/toshimaru/jekyll-toc/issues/24#issuecomment-430768347

JadedBlueEyes avatar Dec 14 '18 20:12 JadedBlueEyes

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 :)

kizycat avatar Mar 14 '19 07:03 kizycat

Following up here because I'd like to have this feature as well!

IHIutch avatar Apr 04 '19 00:04 IHIutch

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.

etsauer avatar Apr 10 '19 14:04 etsauer

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/

toshimaru avatar Apr 10 '19 23:04 toshimaru

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

IHIutch avatar Apr 11 '19 00:04 IHIutch

FYI, {% toc %} + anchor.js sample project:

railsdoc/railsdoc.github.io: Rails API Documentation.

toshimaru avatar Apr 25 '19 15:04 toshimaru

TBH, I'd prefer a solution in the jekyll stage, to minimise in JS - only fuctionality and load times.

JadedBlueEyes avatar Apr 26 '19 19:04 JadedBlueEyes