Table of contents in markdown for Nikola

504 Views Asked by At

I've been using Sphinx for my personal website for the past years and realized that I more have a blog with posts and few pages and did the conversion to Nikola in the past days. I also took the opportunity to switch to Markdown as I use it with R and Stack Overflow and everywhere else as well.

I have set in my Sphinx theme to have a local table of contents in the sidebar. There are a handful of very long (over 10k words) posts that would benefit from a local table of contents. I saw that the Nikola manual is written in reST and uses the contents directive. I would like to use that also in those posts.

I could convert these few posts back to reST and use the contents directive, but I'd like to avoid that. Can this be accomplished somehow?

2

There are 2 best solutions below

2
On BEST ANSWER

Updated

Using [TOC] which is a feature of an extension enabled by default. My firts answer was an misinterpretation of your question.

Firts answer

Using Nikola, may be you are interested in "archive" option. This is a default page that include all your posts (optional, this is grouped by date). Example in my blog: https://www.cosmoscalibur.com/archive.html .

1
On

Nikola uses Python-Markdown by default. It supports a TOC extension that one can enable in the conf.py. Then one can use a [TOC] marker anywhere in the document to get a local table of contents.