如何在 GitHub 风格的 Markdown 中创建编号清单(又名任务列表)?

问题描述 投票:0回答:1

我正在尝试在我创建的这个 github 问题中创建一个编号清单。 我发现这篇博客文章解释了如何创建无序清单,但是有没有办法创建有序清单?

通过实验,这是我能找到的最接近的降价:

1. - [ ] If `TestRestTemplate` can be used with spring-data-rest, please provide examples of using it with response bodies more complex than `String` or `Map<?, ?>`. e.g., a `Person` class.
2. - [ ] Please also include a `postForEntity` <s>and/or `putForEntity`</s>(`putForEntity` doesn't exist) example, because I see a lot of people struggling to make requests that send a complex class, e.g., `Person`, in the request body.
3. - [ ] If `TestRestTemplate` is the *wrong* tool for the job, please recommend the right tool or a better tool. This might already be documented, but I've been unable to find it.

但是数字和复选框之间的空格看起来不对。

有没有更好的方法在 github 风格的 markdown 中创建编号清单?

github markdown github-flavored-markdown
1个回答
0
投票
1. [ ] If `TestRestTemplate` can be used with spring-data-rest, please provide examples of using it with response bodies more complex than `String` or `Map<?, ?>`. e.g., a `Person` class.
2. [ ] Please also include a `postForEntity` <s>and/or `putForEntity`</s>(`putForEntity` doesn't exist) example, because I see a lot of people struggling to make requests that send a complex class, e.g., `Person`, in the request body.
3. [ ] If `TestRestTemplate` is the *wrong* tool for the job, please recommend the right tool or a better tool. This might already be documented, but I've been unable to find it.

只需将项目符号列表标记 (

-
) 替换为有序列表标记 (
1.
)。请注意,spec 特别指出:

任务列表项是其中第一个块是一个段落,该段落以任务列表项标记开头,并且在任何其他内容之前至少有一个空格字符。

列表项定义为:

如果列表的组成列表项以有序列表标记开头,则列表是有序列表;如果其组成列表项以项目符号列表标记开头,则列表是项目符号列表。

因此,如果将这两者放在一起,那么您将采用适当的列表标记,并在其后面跟随任务列表项标记。我意识到该规范没有显示任何有序任务列表的示例,但 GitHub 评论中的快速测试表明它有效。

顺便说一下,通过同时使用两种列表标记类型,您实际上是将一个列表项嵌套在另一个列表项中。您有一个外部有序列表项,其中有一个无序列表项,并且该无序列表项包含复选框和内容。这解释了您所看到的额外空白。

© www.soinside.com 2019 - 2024. All rights reserved.