Closed a4z closed 1 year ago
Additional info: Markdownlint, expects 2 spaces https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md007
The original Markdown specification requires lists to be indented by 4 spaces. If there are fewer spaces, it is not counted as indentation.
So first off, I sure hope that this linter can be changed so it doesn't recommend broken Markdown instead of correct Markdown.
Example for markdownlint: https://github.com/mkdocs/mkdocs/blob/56b235a8ad43f2300d17f87e6fa4de7a3d764397/.markdownlintrc#L14
MkDocs uses Python-Markdown which closely follows this original specification.
So, if you put such a list into a normal Markdown file within MkDocs, it will also be considered a flat list - not indented. So, you already have a problem with MkDocs regardless of this plugin. Just try it and see.
mkdocs-literate-nav doesn't parse Markdown, it uses exactly what MkDocs parsed. So, if you solve the issue you're having with MkDocs overall, it will also solve the issue for this plugin.
To solve this for MkDocs overall, I believe this plugin will do the trick: https://github.com/radude/mdx_truly_sane_lists
markdown_extensions:
- mdx_truly_sane_lists
lot of valuable information, thank you!
using mdx_truly_sane_lists and 2 spaces makes the navigation.md rendered correctly, but the navigation is still messed up.
there seems to be no real solution, except, to keep the indent on 4 spaces and add a linter config to enforce that
Oh, sorry. So what I said is wrong 😞
mkdocs-literate-nav doesn't parse Markdown, it uses exactly what MkDocs parsed. So, if you solve the issue you're having with MkDocs overall, it will also solve the issue for this plugin.
Instead, it just uses Python-Markdown without any extensions.
I could do a change to actually make it work like I said, but not sure what's best.
mdx_truly_sane_lists seems to be super nice and helpful. It fixes some docs I have imported, where no one will ever have the energy to reformat them. It would be awesome if it could be used, also in the nav section and have a consistent style throughout the project
Thanks for the productive discussion. I have opened a pull request that does this. Likely to be released tomorrow.
I even discovered that Python-Markdown actually has configurable indentation, but it's impossible to specify it in MkDocs itself.
Thank you for following up on the topic and for the fast reaction! So great getting that feature in such a short time.
I even discovered that Python-Markdown actually has configurable indentation, but it's impossible to specify it in MkDocs itself.
Do you think this should be reported to mkdocs?
Well I'm keeping track of this for mkdocs myself. I think in the end it's actually not such a useful config in the general case because https://github.com/Python-Markdown/markdown/blob/4dab9a7436357173fad08a0f4e67a63daaaa15a6/docs/index.md?plain=1#L93
this will affect indentation for all aspects of the syntax (including root level code blocks).
-doesn't seem like something I'd want to encourage
Hi,
It seems I do not get the site map when the markdown file I use is indented 2 spaces. Only 4 works. What is unfortunate since this conflicts with some auto-format rules I have.
Is there a way to make it work with 2 spaces?
like this
instead of
?