DEV Community

Diego Carrasco Gubernatis
Diego Carrasco Gubernatis

Posted on • Originally published at diegocarrasco.com on

How to add a table of contents (TOC) to a markdown post or page to nikola ssg

You want to add an automatically created table of content to your markdown post in Nikola SSG.

Nikola uses by default python-markdown which supports the toc extension.

First you need to enable the markdown extension in config.py

MARKDOWN\_EXTENSIONS = ['markdown.extensions.toc']

Enter fullscreen mode Exit fullscreen mode

Then add the short code for TOC in your markdown file

[TOC]

Enter fullscreen mode Exit fullscreen mode

References

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay