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

markdown-toc doesn't ignore code blocks

Open waveman68 opened this issue 7 years ago • 4 comments

In markdown, you use ``` to fence of code blocks:

import os
# imports os module

The # is a comment character in python, but is used for headings in markdown. TOC should ignore all characters in code block, since # is a common comment escape in several programming languages.

waveman68 avatar Mar 13 '17 20:03 waveman68

This is really a Problem for me... A bad Workaround is to set updateOnSave:0 and edit the TOC manually. After the next save the TOC is fixed.

Example for reproduction of the bug:

  • Heading 1
    • Dings
    • Sachen
  • Another Heading
    • Example - ###################
  • Example not Heading! # - ###################

Heading 1

Dings

Sachen

Another Heading

Example

#########################
# Example not Heading!  #
#########################

mmatiaschek avatar May 30 '17 21:05 mmatiaschek

Duplicate of #88 and #89 Check my comment under #88 ?

chruxin avatar Jul 18 '17 03:07 chruxin

Same here. It makes it impossible to use now :(

eclaassens avatar Aug 17 '17 14:08 eclaassens

@eclaassens I have resortet to pandoc - it produces beautiful documents for me. I can use CSS and even place the TOC after a title/header page by creating the document in a two step process.

mmatiaschek avatar Aug 17 '17 16:08 mmatiaschek