首页 > 解决方案 > Markdown:在嵌套列表之后继续列表中的文本

问题描述

我需要在列表中插入一个子列表,然后继续项目中的文本:

1. Start of the item text
    - First item of sublist;
    - Second item of sublist;

More text of the first item.

2. Second Item

3. Third item

嵌套列表后面的文本在渲染后没有正确对齐(应该对齐“开始”,对齐“1.”)。有什么建议吗?

标签: listmarkdown

解决方案


文本应该与数字后的文本左对齐,然后渲染的文本将与之对齐。

这是您的示例:

1. Start of the item text
    - First item of sublist;
    - Second item of sublist;
      
      More text of the sublist of the first item.
The pending text of "More text of the sublist of the first item."

  More text of the first item.
The pending text of "More text of the first item."

2. Second Item

3. Third item

第一行文本有两个字符:文本内容前1 .有一个空格 Start of...

那么你要对齐的文本也应该在文本内容之前有3个空格 More text of...

此外,在文本内容之前有<=N 个空格(N 表示列表上下文的前缀文本的长度,在本例中,N=3)将使内容与此列表文本对齐

例如,有1 ~ 3 个空格将使文本与第 1 行文本对齐,有4 ~ 6 个空格将使文本与第 2 行文本对齐,


推荐阅读