Track3 / hermit

A minimal & fast Hugo theme for bloggers
https://hugo-theme-hermit.netlify.com/
MIT License
1.12k stars 304 forks source link

TOC H1 stripped as of Hugo 0.61 #112

Open Sieboldianus opened 4 years ago

Sieboldianus commented 4 years ago

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.