Table of contents (TOC) not generating anchor hyperlinks for <h2> tags, only ##-style headings #2751
-
Environment
Expected behaviorI expect setting <h2>Foo</h2> to generate working anchor tags in the table of content (toc) sidebar, the same way it works for using markdown shorthand like ## Foo Steps to reproduce the behaviorIf you visit https://mmistakes.github.io/minimal-mistakes/docs/helpers/ right now you can see this happening in the toc there; the Placeholder 1, Placeholder 2, Placeholder 3 text in the toc are not hyperlinks but just plain text. Here is a screenshot: I can reproduce the behavior on my own Jekyll site by writing headers like OtherN/A |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I would rather say this is the correct behavior. The ToC template expects headings to have an HTML If you want manually-written HTML headings to have ToC entries, create your <h2 id="placeholder-1">Placeholder 1</h2> |
Beta Was this translation helpful? Give feedback.
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 withauto_ids
enabled.If you want manually-written HTML headings to have ToC entries, create your
id
as well: