First, you need to enable the toc extension for Markdown in your Pelican configuration.

MARKDOWN = {
  'extension_configs': {
    'markdown.extensions.toc': {}
  }
}

Then enable permalink option available for the toc extension.

MARKDOWN = {
  'extension_configs': {
    'markdown.extensions.toc': {
      'permalink': 'true',
    }
  }
}

Enabling the permalink option will provide direct links to each heading.

Hover over following example heading to see the permalink.

Example Heading

You would get this,

Permalinks example using Markdown

Tip

When set to True the paragraph symbol or ¶ is used by Python markdown. This becomes part of the RSS feed.

We recommend setting permalink option to a space.

MARKDOWN = {
  'extension_configs': {
    'markdown.extensions.toc': {
      'permalink': ' ',
    }
  }
}

Понравилась статья? Расскажите о ней на: TwitterFacebookEmail


Что почитать


Дата

Категория

Components

Тэги

Будьте с нами