bitdowntoc: markdown TOC for all (even BitBucket ?)

Kezaco ?

bitdowntoc (bitbucket markdown toc) is a flexible Markdown TOC Generator, available both as a standalone jar and a free online service.

Why using it ?

Contrary to other tools such as GitHub Wiki TOC generator, it suppo…


This content originally appeared on DEV Community and was authored by Lucy Linder

favicon

Kezaco ?

bitdowntoc (bitbucket markdown toc) is a flexible Markdown TOC Generator, available both as a standalone jar and a free online service.

Why using it ?

Contrary to other tools such as GitHub Wiki TOC generator, it supports many different hosting platforms. More importantly, it can also generate working TOCs in BitBucket Servers who lack even the ability to add anchor links to titles in READMEs.

Here are the options to use for the most well-known platforms (see bitdowntoc's README for more info):

  • BitBucket Server → generate anchors
  • GitLab → concat spaces, do not generate anchors
  • GitHub → do not concat spaces, do not generate anchors

You can use the [TOC] placeholder to control where the TOC will be located. Header(s) above it will be ignored.

You can regenerate you TOC anytime, bitdowntoc is smart enough to detect the changes.

? ? Everything is generated locally, **no tracking* or anything of the sort !*

Web interface tricks

Go fast Paste your markdown content, click generate then copy. Done, the TOC-ified markdown content is in your clipboard.

Save your preferences Have a look at the options (options button) and select your preferences once, then click save to save them to local storage. They will be loaded automatically next time.

Light/dark theme If you prefer dark interfaces, click on the sun/moon icon on the top right.

Why I did it

I got the motivation from the lack of existing tools supporting BitBucket Server.

Indeed, BitBucket Server (at least at version 6), 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 !

What I learned

This project was a good excuse to play with Kotlin MPP (Multi Platform Project). I implemented the TOC generation logic in a common module, which is then used by a JVM module for the cli and a JS module for the web interface.

I was amazed by how great it felt to "write JS" using all the wonderful features of kotlin (type-safety, extension functions, generics, ...).
I didn't encounter any real difficulties (which is amazing), except maybe two things:

  • regexes (used in the common module) will work differently depending on the runner (JS/browser vs JVM), and
  • tests in common module are limited (e.g. not possible to read a file).

To find out more, check the code !

Written with ❤️ by derlin


This content originally appeared on DEV Community and was authored by Lucy Linder


Print Share Comment Cite Upload Translate Updates
APA

Lucy Linder | Sciencx (2021-09-24T13:46:46+00:00) bitdowntoc: markdown TOC for all (even BitBucket ?). Retrieved from https://www.scien.cx/2021/09/24/bitdowntoc-markdown-toc-for-all-even-bitbucket-%f0%9f%98%89/

MLA
" » bitdowntoc: markdown TOC for all (even BitBucket ?)." Lucy Linder | Sciencx - Friday September 24, 2021, https://www.scien.cx/2021/09/24/bitdowntoc-markdown-toc-for-all-even-bitbucket-%f0%9f%98%89/
HARVARD
Lucy Linder | Sciencx Friday September 24, 2021 » bitdowntoc: markdown TOC for all (even BitBucket ?)., viewed ,<https://www.scien.cx/2021/09/24/bitdowntoc-markdown-toc-for-all-even-bitbucket-%f0%9f%98%89/>
VANCOUVER
Lucy Linder | Sciencx - » bitdowntoc: markdown TOC for all (even BitBucket ?). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/09/24/bitdowntoc-markdown-toc-for-all-even-bitbucket-%f0%9f%98%89/
CHICAGO
" » bitdowntoc: markdown TOC for all (even BitBucket ?)." Lucy Linder | Sciencx - Accessed . https://www.scien.cx/2021/09/24/bitdowntoc-markdown-toc-for-all-even-bitbucket-%f0%9f%98%89/
IEEE
" » bitdowntoc: markdown TOC for all (even BitBucket ?)." Lucy Linder | Sciencx [Online]. Available: https://www.scien.cx/2021/09/24/bitdowntoc-markdown-toc-for-all-even-bitbucket-%f0%9f%98%89/. [Accessed: ]
rf:citation
» bitdowntoc: markdown TOC for all (even BitBucket ?) | Lucy Linder | Sciencx | https://www.scien.cx/2021/09/24/bitdowntoc-markdown-toc-for-all-even-bitbucket-%f0%9f%98%89/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.