diff --git a/docs/content/en/getting-started/configuration-markup.md b/docs/content/en/getting-started/configuration-markup.md index 2a24fcdd0..ff0095024 100644 --- a/docs/content/en/getting-started/configuration-markup.md +++ b/docs/content/en/getting-started/configuration-markup.md @@ -70,4 +70,7 @@ startLevel : The heading level, values starting at 1 (`h1`), to start render the table of contents. endLevel -: The heading level, inclusive, to stop render the table of contents. \ No newline at end of file +: The heading level, inclusive, to stop render the table of contents. + +ordered +: Whether or not to generate an ordered list instead of an unordered list. diff --git a/docs/data/docs.json b/docs/data/docs.json index 0944ab881..dea7f0bcb 100644 --- a/docs/data/docs.json +++ b/docs/data/docs.json @@ -1387,7 +1387,8 @@ }, "tableOfContents": { "startLevel": 2, - "endLevel": 3 + "endLevel": 3, + "ordered": false }, "goldmark": { "renderer": { diff --git a/hugolib/page__per_output.go b/hugolib/page__per_output.go index bc2a0accc..9697468ff 100644 --- a/hugolib/page__per_output.go +++ b/hugolib/page__per_output.go @@ -292,7 +292,7 @@ func (p *pageContentOutput) TableOfContents() template.HTML { p.p.s.initInit(p.initMain, p.p) if tocProvider, ok := p.convertedResult.(converter.TableOfContentsProvider); ok { cfg := p.p.s.ContentSpec.Converters.GetMarkupConfig() - return template.HTML(tocProvider.TableOfContents().ToHTML(cfg.TableOfContents.StartLevel, cfg.TableOfContents.EndLevel)) + return template.HTML(tocProvider.TableOfContents().ToHTML(cfg.TableOfContents.StartLevel, cfg.TableOfContents.EndLevel, cfg.TableOfContents.Ordered)) } return p.tableOfContents } diff --git a/markup/goldmark/toc_test.go b/markup/goldmark/toc_test.go index d3a1613cf..19928dd8e 100644 --- a/markup/goldmark/toc_test.go +++ b/markup/goldmark/toc_test.go @@ -58,7 +58,7 @@ And then some. c.Assert(err, qt.IsNil) b, err := conv.Convert(converter.RenderContext{Src: []byte(content), RenderTOC: true}) c.Assert(err, qt.IsNil) - got := b.(converter.TableOfContentsProvider).TableOfContents().ToHTML(2, 3) + got := b.(converter.TableOfContentsProvider).TableOfContents().ToHTML(2, 3, false) c.Assert(got, qt.Equals, `