Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Table of contents in Pelican Blog Generator

Tags:

pelican

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?

like image 443
Petko M Avatar asked Dec 23 '22 15:12

Petko M


1 Answers

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',
}
like image 50
Petko M Avatar answered Jan 02 '23 11:01

Petko M