I know there is no current standard in Markdown to write Table Of Content, but does anyone knows a trick to do it on dev.to?
Could it work by using HTML anchors?
But how can I know the future URL of the article I'm currently writing?
Any help would be welcome :)
Top comments (7)
You can use inline anchors with Markdown:
This way you don't need to know the final URL
Thanks for the question and the answer.
I didn't know that trick and I am going to try it in my next post.
Thank you! This is just what I’ve been looking for.
The Editor Guide is also a nice resource to find out what's possible on dev.to: dev.to/p/editor_guide#markdown-links
I faced the issue when dev.to does not rended a few levels of table of content:
While markdown is rendering it as three level of content dev.to renders it only as two. What is the best way to tackle this problem?
I managed to get a third level by using a 5 space indent:
Not sure why a 4 space indent doesn't work, possibly because it's interpreted as code.
Most solutions I found on dev.to are so tedious, I created a tool to do it for you: derlin.github.io/bitdowntoc/ (choose the
dev.to
preset ;))To know more, see my article:
Finally a clean and easy way to add Table of Contents to dev.to articles 🤩
Lucy Linder ・ Jan 2 ・ 4 min read