kramdown 中的嵌套有序列表
Nested ordered list in kramdown
根据 kramdown documentation 嵌套无序列表(以及结果)的语法如下。
1. 1st item
2. 2nd item
1. 1st sub-item of 2nd item
2. 2nd sub-item of 2nd item
3. 3rd item
1. 1st sub-item of 3rd item
2. 2nd sub-item of 3rd item
是否有可能实现这样的目标?
1. 1st item
2. 2nd item
2.1. 1st sub-item of 2nd item
2.2. 2nd sub-item of 2nd item
3. 3rd item
3.1. 1st sub-item of 3rd item
3.2. 2nd sub-item of 3rd item
注意:我必须使用 kramdown,我无法更改它以支持其他 markdown 解析器。
我认为这个问题一开始是错误的,因为它更像是 CSS 的问题而不是 kramdown 的问题。根据 this question 的答案更改 CSS 就足够了。
ol {
counter-reset: item;
}
ol > li {
counter-increment: item;
}
ol ol > li {
display: block;
}
ol ol > li:before {
content: counters(item, ".") ". ";
margin-left: -20px;
}
根据 kramdown documentation 嵌套无序列表(以及结果)的语法如下。
1. 1st item
2. 2nd item
1. 1st sub-item of 2nd item
2. 2nd sub-item of 2nd item
3. 3rd item
1. 1st sub-item of 3rd item
2. 2nd sub-item of 3rd item
是否有可能实现这样的目标?
1. 1st item
2. 2nd item
2.1. 1st sub-item of 2nd item
2.2. 2nd sub-item of 2nd item
3. 3rd item
3.1. 1st sub-item of 3rd item
3.2. 2nd sub-item of 3rd item
注意:我必须使用 kramdown,我无法更改它以支持其他 markdown 解析器。
我认为这个问题一开始是错误的,因为它更像是 CSS 的问题而不是 kramdown 的问题。根据 this question 的答案更改 CSS 就足够了。
ol {
counter-reset: item;
}
ol > li {
counter-increment: item;
}
ol ol > li {
display: block;
}
ol ol > li:before {
content: counters(item, ".") ". ";
margin-left: -20px;
}