Python-Markdown / markdown

A Python implementation of John Gruber’s Markdown with Extension support.
https://python-markdown.github.io/
BSD 3-Clause "New" or "Revised" License
3.71k stars 856 forks source link

Does not handle comments in code snippets #1424

Closed jrinder42 closed 8 months ago

jrinder42 commented 8 months ago

As the title describes, if there are comments in a code snippet, it treats them as headers incorrect when converting to html (markdown.markdown(text))

...
# this is a comment
...

It will treat # this is a comment as a header as opposed to just a comment

waylan commented 8 months ago

Have you enabled the fenced_code extension? As a reminder, the original Syntax rules do not include any provision for fenced code blocks. Therefore, they are not enabled by default.

jrinder42 commented 8 months ago

Thanks, that solves this for me.