×
This tool should work properly for GitLab, GitHub and BitBucket Server
(BitBucket has direct support for [TOC]
).
Here are the important option differences:
- BitBucket Server → generate anchors
- GitLab → concat spaces, do not generate anchors
- GitHub → do not concat spaces, do not generate anchors
If your markdown renderer is not in the list, I suggest the BitBucket Server profile.
As it manually inserts anchors in the markdown, you should be good to go as long as the renderer supports
<a name="some-heading">
tags.
Use the [TOC] to control where the TOC will be located.
Header above it will be ignored.
I got the motivation from the lack of existing tools supporting BitBucket Server.
Indeed, BitBucket Server (at least at version 7), doesn't generate heading IDs for Markdown.
This only way I found to have a nice TOC was to create the anchors myself, using:
<a name="some-heading">
. This is tiresome to do manually.
I found this blog
talking about a Vim plugin doing it for you, but this requires Vim (obviously) and is just a branch in some
repo... Hence bitdowntoc !
This was also a great way to play with Kotlin MPP: a common module does the TOC generation, and is used by
a JVM module (cli) and this page (JS). To find out more, check the code !
⇝ https://github.com/derlin/bitdowntoc ⇜