Closed OdyAsh closed 1 year ago
Hello and thank you for the reporting.
I believe the problem lies in the space between the three backticks and the language identifier. Usually, in markdown, you use '''python
(replace single quotes with backticks) and not ''' Python
. What happens is the start of the first code block is not seen as a code block by BitDownToc, but the closing one is (and is treated as the beginning of a code block, thus ignoring everything until closed).
To avoid treating non-code blocks as code blocks, my rule is to use the regex '''([a-z0-9]+)?
. I could change this and just treat whatever line starts with backticks as a code block, but I don't know if it may raise false positives. Do you see an example of a line beginning with three backticks which is NOT a code block?
I hesitate... In the meantime, can you simply change the ''' Python
to '''python
? (this is the standard markdown syntax for highlighted code blocks).
First of all, thanks for the quick reply; I've learned something new about markdown! 😅
Regarding this:
I Do you see an example of a line beginning with three backticks which is NOT a code block?
Not at the moment unfortunately.
In any case, I think adding a simple "side-note" anywhere in the website --- something like 'type "python" instead of "
python"' --- will help people avoid this mistake.
However, as you said, what you suggested IS the standard markdown syntax, so you are completely justified to leave things as they are.
Thanks again for the quick reply! 🙌
Happy to help!
Thanks for using bitdowntoc, and if you haven't already, star the repo 😊
Changed the way bitdowntoc detects code blocks in https://github.com/derlin/bitdowntoc/commit/82e14e35804c3721aa729c1c0f35562ea0c54f74, the issue should not happen again.
If a language identifier (e.g., "Python") is used in a markdown's code fence, BitDownToc will not generate subsequent headers. Example: (ignore the backticks (
``) at the start and at the end, they are just used with