allejo / jekyll-anchor-headings

A GitHub Pages compatible way of adding anchors to your headings without a plug-in or JavaScript :octocat:
https://pure-liquid.allejo.org/
MIT License
186 stars 31 forks source link

Excluding/limiting by class #6

Closed XhmikosR closed 5 years ago

XhmikosR commented 5 years ago

@allejo: after making the switch I just noticed that the only way to limit the target anchors is their header level.

Do you think it would be possible to add a parent class as a limit, like .content > h2?

Example: https://twbs-bootstrap4.netlify.com/docs/4.1/utilities/image-replacement/#warning

No big deal if it's hard to add such feature, we'll use JS or CSS to handle this, but I thought I'd ask :)

/CC @MartijnCuppens

allejo commented 5 years ago

I'm afraid this wouldn't be possible. Since this project follows the same methodology as jekyll-toc, the problems discussed in https://github.com/allejo/jekyll-toc/issues/3 would apply here.

Since the goal of this project is to be compatible with GH pages, I'm limited to clever-ish string manipulation of HTML so i have no real information on the DOM structure.

XhmikosR commented 5 years ago

No worries, I thought so too :)

We'll work around it.