New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ability to add custom attributes based on headings to the links #18
Comments
You're problem may be an XY problem. Instead of having a link with an icon and using <h2 id="motive">
Motive
<a href="#motive" class="anchor-link">
<span aria-hidden class="icon icon-link"></span>
<span class="visually-hidden">Motive</span>
</a>
</h2> Wouldn't that also solve your problem? |
Technically that should work, yes. The reason why I wanted to do it that way is because I've seen popular sites like Material UI and Vite.js add Your solution works for me for now, but let's say I want to add some other custom attribute ( |
a) You can pass a function, it is passed the heading? 🤔 Or do you mean that |
a) I was just saying it'd be great if b) yeah. This seems better. I think I can do that with |
I’m up for a PR to add function support I think, I don’t see downsides? |
Makes sense to have it as a function, also aligns better with the |
aria-label
to the links
This comment has been minimized.
This comment has been minimized.
it’s in 7.0.0! |
Initial checklist
Problem
It would be great if the plugin allow us to insert labels based on the heading text like this:
Solution
Maybe accept a function and expose the heading node so that we can freely modify/add extra dynamic properties like these, just like how it currently works for
options.content
option would be sufficient I believefor example:
should log:
Alternatives
or ... the individual property keys takes a function instead with a heading node? Like this:
I don't know the performance implication of this, but this doesn't feel a good enough alternative
The text was updated successfully, but these errors were encountered: