【问题标题】:Nested ordered list in kramdownkramdown中的嵌套有序列表
【发布时间】:2018-06-23 17:38:45
【问题描述】:

根据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 解析器。

【问题讨论】:

    标签: markdown kramdown


    【解决方案1】:

    我认为这个问题一开始是错误的,因为它更多的是 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;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多