项目符号列表中的缩进段落无法正确呈现
Indented paragraph in bullet list not rendering correctly
我正在使用 MkDocs 来构建我的文档。
在我的 .md
文件中,我有以下内容:
* test
content in bullet list with two spaces
段落应与项目符号项处于同一缩进级别,如下所示:
测试:
项目符号列表中的内容有两个空格
但它被错误地呈现为一个单独的段落:
- 测试:
项目符号列表中的内容有两个空格
只有 4 个空格才能正确呈现,但应该是 2 个空格。
我该如何更改?
Markdown 内容块(用于列表延续、源代码块等)需要缩进 4 space 或 1 个制表符。参见 https://www.markdownguide.org/basic-syntax/#adding-elements-in-lists
要么将你的两个 space 缩进更改为 4 space,要么使用制表符。
如果您使用制表符,您可以将制表位距离设置为 2,以保留您当前拥有的编辑体验。
Markdown 有许多不同的“风格”,他们并不都同意什么是正确的语法。
According to MkDocs 文档:
MkDocs uses the Python-Markdown library to render Markdown documents to HTML.
以及 Python-Markdown 文档 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.
所以您对此无能为力,您在使用 MkDocs 时必须缩进四个空格(或一个制表符)。
应该注意的是,几乎所有其他 Markdown 渲染器(不仅仅是“很多”)都对这条规则更加宽松,因为 Babelmark comparison demonstrates. That's because they follow the more recent CommonMark 语法规范是为了解决不一致和澄清原文中的歧义而开发的Markdown 语法规则。
我正在使用 MkDocs 来构建我的文档。
在我的 .md
文件中,我有以下内容:
* test
content in bullet list with two spaces
段落应与项目符号项处于同一缩进级别,如下所示:
测试:
项目符号列表中的内容有两个空格
但它被错误地呈现为一个单独的段落:
- 测试:
项目符号列表中的内容有两个空格
只有 4 个空格才能正确呈现,但应该是 2 个空格。
我该如何更改?
Markdown 内容块(用于列表延续、源代码块等)需要缩进 4 space 或 1 个制表符。参见 https://www.markdownguide.org/basic-syntax/#adding-elements-in-lists
要么将你的两个 space 缩进更改为 4 space,要么使用制表符。
如果您使用制表符,您可以将制表位距离设置为 2,以保留您当前拥有的编辑体验。
Markdown 有许多不同的“风格”,他们并不都同意什么是正确的语法。
According to MkDocs 文档:
MkDocs uses the Python-Markdown library to render Markdown documents to HTML.
以及 Python-Markdown 文档 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.
所以您对此无能为力,您在使用 MkDocs 时必须缩进四个空格(或一个制表符)。
应该注意的是,几乎所有其他 Markdown 渲染器(不仅仅是“很多”)都对这条规则更加宽松,因为 Babelmark comparison demonstrates. That's because they follow the more recent CommonMark 语法规范是为了解决不一致和澄清原文中的歧义而开发的Markdown 语法规则。