Search code examples
jekyllgithub-pagesgithub-flavored-markdownkramdown

How to add GFM task lists in Jekyll?


GFM supports Task lists:

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

how do I use this in Jekyll pages? In my site's _config.yml

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

This works for most other GFM constructs. but not with Task Lists.

Example markdown:

#### 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.

Expected:

enter image description here

Reality: enter image description here


Solution

  • Which version of kramdown are you using? GFM task lists are supported as of 1.16.0 (with a bugfix released in 1.16.1). To eliminate the bulleted list, list-style-type: none is necessary.

    On my system, the following test file

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

    generates the expected

    GFM task list

    using kramdown 1.16.2 and Jekyll 3.6.2. If your kramdown is earlier than 1.16.1, you should be able to simply

    $ gem update kramdown
    

    to gain the functionality.