Table of contents in Pelican Blog Generator
Asked Answered
I

1

5

I know in Pelican I can use the [TOC] line for table of contents, but what do I need to do to enable that?

I have to change the MARKDOWN setting in pelicanconf.py (settings docs are here), but how does that change look like?

Ibnsaud answered 10/8, 2017 at 5:47 Comment(0)
I
11

Add a markdown.extensions.toc key to the MARKDOWN dictionary in your pelican configuration file. The key should correspond to a dictionary of configuration options for the Markdown extension.

The following MARKDOWN dictionary adds a minimal configuration for the table of contents to the default MARKDOWN dictionary specified in the Pelican documentation:

MARKDOWN = {
  'extension_configs': {
    'markdown.extensions.toc': {
      'title': 'Table of contents:' 
    },
    'markdown.extensions.codehilite': {'css_class': 'highlight'},
    'markdown.extensions.extra': {},
    'markdown.extensions.meta': {},
  },
  'output_format': 'html5',
}
Ibnsaud answered 10/8, 2017 at 5:47 Comment(3)
Tx! Perhaps a silly question, but: How do I call/activate that in the templates ?Clausen
Add [TOC] to your article/page.Gigot
Thank you! Still works as of Pelican 4.2.0 (together with [TOC] as per @nwly's comment).Shorthand

© 2022 - 2024 — McMap. All rights reserved.