I’m creating the readme for a GitHub project. I’m editing in BBEdit and previewing in Marked2.
The readme has lots of sections, marked by ### , #### etc.
I manually created a table of contents with internal hrefs to these headings. In Marked2 it worked fine. However, when I push to GitHub the hrefs are mostly broken - as Github generates them in a different way to Marked2. (They coincide only when the heading is a single word.) I can see the different formats - and they’re not translatable from one format to the other. Obviously both could be generated from the heading text.
Does anyone know how to solve this problem? Either a preference for GitHub or one for Marked2?
The GitHub flavoured markdown seems not to be able to handle spaces in anchor-names (see discussion at https://gist.github.com/asabaylus/3071099). This would indeed explain why it currently only works with single word headings.
Solutions that are given in that thread, is e.g. a script that add an additional anchor (in which spaces are replaced with a dash, which are usable in the TOC.