Skip to content

Fragments for CommonMark headings #21546

Discussion options

You must be logged in to vote

Hi @mattias-p! 👋t2:  These anchor links for markdown headings are actually added outside of the CommonMark renderer itself. We use the github/markup repository for rendering markup languages to HTML:

https://github.com/github/markup#github-markup

And then pass that content through various other filters in the html-pipeline (mentioned in Step 3 above). The ‘named anchors’ link there is what you’re looking for. Here it is for ease:

https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/toc_filter.rb

We don’t actually render a table of contents for markdown files, but we do use this to render the anchor links.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants