markdown-toc icon indicating copy to clipboard operation
markdown-toc copied to clipboard

Make Python Markdown compatible (easy)

Open feinstaub opened this issue 8 years ago • 4 comments

Currently a typical TOC looks like this:

- [Was ist Markdown?](#was-ist-markdown)
- [Lokale Vorschau im Browser](#lokale-vorschau-im-browser)
  * [Installieren](#installieren)
  * [Verwenden](#verwenden)
  * [So sieht es aus](#so-sieht-es-aus)
- [Inhaltsverzeichnis mit markdown-doc](#inhaltsverzeichnis-mit-markdown-doc)
  * [Installieren](#installieren-1)

This results a flat TOC when using python markdown (see Offline renderer: https://github.com/joeyespo/grip/issues/35). With a small change this could be solved: Instead of two indentation spaces one must use four:

- [Was ist Markdown?](#was-ist-markdown)
- [Lokale Vorschau im Browser](#lokale-vorschau-im-browser)
    * [Installieren](#installieren)
    * [Verwenden](#verwenden)
    * [So sieht es aus](#so-sieht-es-aus)
- [Inhaltsverzeichnis mit markdown-doc](#inhaltsverzeichnis-mit-markdown-doc)
    * [Installieren](#installieren-1)

feinstaub avatar Mar 29 '17 18:03 feinstaub

Instead of two indentation spaces one must use four:

does this conflict with indented code blocks in lists?

jonschlinkert avatar Mar 29 '17 18:03 jonschlinkert

I just tried it. No, it does not conflict. :-) (Otherwise one could have added an option to support the Python flavour)

feinstaub avatar Mar 29 '17 18:03 feinstaub

I think we can just allow the indentation to be passed.

jonschlinkert avatar Mar 29 '17 20:03 jonschlinkert

https://github.com/jonschlinkert/markdown-toc/blob/master/cli.js#L41 is there, but didn't make it in the latest release. I've opened #129 to resolve that.

slavaaaaaaaaaa avatar Aug 22 '18 20:08 slavaaaaaaaaaa