I'm using MkDocs to build my documentation.
In my .md
file I have the following content:
* test
content in bullet list with two spaces
The paragraph should be at the same indentation level as the bullet item, like this:
Test:
content in bullet list with two spaces
But it is rendered incorrectly, as a separate paragraph:
content in bullet list with two spaces
It will only render correctly with 4 spaces, but it should be 2 spaces.
How can I change this?
There are many different "flavors" of Markdown, and they don't all agree on what's the correct syntax.
According to the MkDocs documentation:
MkDocs uses the Python-Markdown library to render Markdown documents to HTML.
And the Python-Markdown documentation notes:
The syntax rules clearly state that when a list item consists of multiple paragraphs, “each subsequent paragraph in a list item must be indented by either 4 spaces or one tab” (emphasis added). However, many implementations do not enforce this rule and allow less than 4 spaces of indentation. The implementers of Python-Markdown consider it a bug to not enforce this rule.
So there's nothing you can do about it, you'll have to indent by four spaces (or one tab) when using MkDocs.
It should be noted that almost all other Markdown renderers (not merely "many") are more relaxed about this rule as the Babelmark comparison demonstrates. That's because they follow the more recent CommonMark syntax specification, which was developed to resolve inconsistencies and clarify ambiguities in the original Markdown syntax rules.