-
Notifications
You must be signed in to change notification settings - Fork 32
Add toc link when enable set to true. #69
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
base: master
Are you sure you want to change the base?
Conversation
Anchor link is a part of toc, full toc feature needs to generate the table of content or provide a method to get the toc. |
Yes, this is one of feature of toc, but i thought it's optional. But, i consider |
I think this is something best implemented in a custom renderer rather than upstream |
Yes, I use it on my fork, if we make the |
I'm not sure. On one hand this is useful; on the other this isn't something specified in the commonmark or gfm specs, which leads me towards it being something implemented by those who want it. How do we feel about out of spec extensions? |
I think anchor links for every heading are a very valuable UX feature. However, it's a bit tricky getting the HTML right. The current implementation for example creates an anchor element adjacent to the header element. But they're not directly grouped together, which can make it hard to style properly. <div class="header-wrapper">
<h2 id="title">Title</h2>
<a href="#title">§</a>
</div> Improving accessibility requires some further enhancements to make sense of the anchor link. IMO a decent default implementation could very well fit into upstream. But it should also be easily customizable with custom renderers. So maybe it's best to start with that to make sure it's simple to override the details without changing the overall structure? |
d97572b
to
0715608
Compare
Maybe we can add a new option instead of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing unit tests, add it pls.
Enable display a link svg when set
Markd::Options.new(toc: true)
, like following screenshot.