Skip to content

Table of contents (TOC) not generating anchor hyperlinks for <h2> tags, only ##-style headings #2751

Answered by iBug
abevoelker asked this question in Q&A
Discussion options

You must be logged in to vote

I would rather say this is the correct behavior. The ToC template expects headings to have an HTML id attribute, which Jekyll's default Markdown renderer, Kramdown, will automatically generate with auto_ids enabled.

If you want manually-written HTML headings to have ToC entries, create your id as well:

<h2 id="placeholder-1">Placeholder 1</h2>

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@abevoelker
Comment options

@iBug
Comment options

@abevoelker
Comment options

Answer selected by mmistakes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2751 on December 10, 2020 13:40.