Petko M
Petko M

Reputation: 724

Table of contents in Pelican Blog Generator

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?

Upvotes: 5

Views: 984

Answers (1)

Petko M
Petko M

Reputation: 724

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',
}

Upvotes: 11

Related Questions