facelessuser / pymdown-extensions

Extensions for Python Markdown
https://facelessuser.github.io/pymdown-extensions/
Other
926 stars 248 forks source link

Fenced code resets list item numbering in Superfences #2340

Closed MikeSpreitzer closed 3 months ago

MikeSpreitzer commented 3 months ago

Description

When I put a fenced code block inside an item in a numbered list, the following list item is numbered 1 in the rendered output. For an example, see the source in https://github.com/kubestellar/kubestellar/blob/cf49b4541eeca435607d8f08ac2dcb7c542a7385/docs/content/direct/examples.md#common-setup and the output in the following screenshot.

Screenshot 2024-03-19 at 4 00 30 PM

Minimal Reproduction

Have a numbered list. Put a fenced code block inside the first item in the list. Observe that the rendered output gives the number "1" to the second list item.

Version(s) & System Info

Markdown                       3.3.7
MarkupSafe                     2.1.2
mkdocs                         1.4.2
mkdocs-awesome-pages-plugin    2.8.0
mkdocs-include-markdown-plugin 4.0.4
mkdocs-macros-plugin           0.7.0
mkdocs-material                9.1.0
mkdocs-material-extensions     1.1.1
mkdocs-open-in-new-tab         1.0.2
mkdocs-static-i18n             0.53
Pygments                       2.14.0
pymdown-extensions             9.9.2
facelessuser commented 3 months ago

This has nothing to do with SuperFences and everything to do with how Python Markdown works. It requires new paragraphs, code blocks, etc. under a list to be indented 4 spaces, or you can use tabs which will be normalized as such. Regardless, you need to indent according to Python Markdown's requirement. We do not set those rules, nor do we break them.

MikeSpreitzer commented 3 months ago

Thanks. I find that changing my indenting from 3 to 4 does indeed solve the problem. I read the two links in https://github.com/facelessuser/pymdown-extensions/issues/1031#issuecomment-663213404 and it was not obvious to me that they were saying that I need that much indenting.