代码之家  ›  专栏  ›  技术社区  ›  enator

如何在Jekyll中添加GFM任务列表?

  •  2
  • enator  · 技术社区  · 7 年前

    GFM支持任务列表:

    https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments

    如何在Jekyll页面中使用此选项?在我的网站中 _config.yml

    # Build settings
    markdown: kramdown
    kramdown:
      input: GFM
      hard_wrap: false
    

    这适用于大多数其他GFM构造。但不适用于任务列表。

    降价示例:

    #### Checklist for Aggregations
    - [ ] Always add `max(x)` in the group for size of buckets needed. When data is distributed across multiple content nodes this result can be inaccurate. To increase accuracy we need to use `precision(x)` as well to tune accuracy as we need.
    

    预期:

    enter image description here

    现实情况: enter image description here

    1 回复  |  直到 7 年前
        1
  •  2
  •   Kyle Barbour    7 年前

    您使用的是kramdown的哪个版本?从开始支持GFM任务列表 1.16.0 (在中发布了错误修复 1.16.1 ). 要删除项目符号列表, list-style-type: none is necessary .

    在我的系统上,以下测试文件

    ---
    ---
    
    - [ ] Unchecked
    - [x] Checked
    {: style='list-style-type: none'}
    

    生成预期的

    GFM task list

    使用kramdown 1.16.2和Jekyll 3.6.2。如果您的kramdown早于1.16.1,您应该能够

    $ gem update kramdown
    

    以获得功能。