Track3 / hermit

A minimal & fast Hugo theme for bloggers

Home Page:https://hugo-theme-hermit.netlify.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TOC H1 stripped as of Hugo 0.61

Sieboldianus opened this issue · comments

I was surprised to see my H1 headings gone from the TOC after updating to Hugo 0.61

Apparently, there was a change in 0.60 where they moved to Goldmark:

Previously, there was no out-of-the-box way to specify which heading levels you want the TOC to render. See the related GitHub discussion (#1778). As such, the resulting was going to start at when pulling from {{.Content}}.

Hugo v0.60.0 made a switch to Goldmark as the default library for Markdown which has improved and configurable implementation of TOC. Take a look at how to configure TOC for Goldmark renderer.

I solved this issue by adding the following to my config.toml override:

[markup]
  [markup.tableOfContents]
    endLevel = 3
    startLevel = 1

I am not sure about the backwards compatibility - that means: should this be added to the default config.toml in this repo? I can create a pull request.