# Should Checklist support GFM checkbox syntax?

**URL:** https://meta.discourse.org/t/should-checklist-support-gfm-checkbox-syntax/163686
**Category:** Feature
**Tags:** checklist
**Created:** [September 3, 2020, 4:02pm UTC](https://meta.discourse.org/t/should-checklist-support-gfm-checkbox-syntax/163686 "2020-09-03T16:02:09Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![k4rtik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/k4rtik/32/119508_2.png) [@k4rtik](https://meta.discourse.org/u/k4rtik)
#### Post date: [September 3, 2020, 4:02pm UTC](https://meta.discourse.org/t/should-checklist-support-gfm-checkbox-syntax/163686/1 "2020-09-03T16:02:09Z")

</div>

> [@Discourse Checklist](https://meta.discourse.org/t/discourse-checklist/36362/169):
>
> For self hosters, you can run the task:
> 
> ```plaintext
> rake discourse_checklist:migrate_old_syntax
> 
> ```

So I noticed some existing cheklists on my instance which were showing the older asterisk syntax. I decided to run the above rake task, but they don’t get updated.

IIRC most of the other checklists I have got silently migrated to the new syntax while I upgraded Discourse in past several weeks. But looks like there are some strange ones that the rake task is leaving behind. Anyone has any clues why that might be?

Happy to provide more info if it helps debug things.

**Update:** it looks one of such posts had the syntax `[\*]` (the one automatically generated on checking the checkbox from the UI). So perhaps that’s the case missed by the rake task?

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [September 9, 2020, 8:11pm UTC](https://meta.discourse.org/t/should-checklist-support-gfm-checkbox-syntax/163686/2 "2020-09-09T20:11:01Z")

</div>

@k4rtik the rake task only changes checkboxes at the beginning of a line if I recall correctly.

---

<div class="post-metadata">

### Author: ![k4rtik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/k4rtik/32/119508_2.png) [@k4rtik](https://meta.discourse.org/u/k4rtik)
#### Post date: [September 9, 2020, 8:37pm UTC](https://meta.discourse.org/t/should-checklist-support-gfm-checkbox-syntax/163686/3 "2020-09-09T20:37:05Z")

</div>

The pages I am seeing all have the checkboxes at the beginning of the line. The question is whether the task changes both `[*]` and `[\*]` or just the former syntax?

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [September 9, 2020, 9:20pm UTC](https://meta.discourse.org/t/should-checklist-support-gfm-checkbox-syntax/163686/4 "2020-09-09T21:20:52Z")

</div>

> <https://github.com/discourse/discourse-checklist/blob/56cb4586d4b06e1eb9c853ba677f3978a0929044/lib/checklist_syntax_migrator.rb#L4>

This line should if the checkbox is in the first three characters of the line. I just checked the regex and it appears to match correctly.

---

<div class="post-metadata">

### Author: ![k4rtik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/k4rtik/32/119508_2.png) [@k4rtik](https://meta.discourse.org/u/k4rtik)
#### Post date: [September 10, 2020, 9:12pm UTC](https://meta.discourse.org/t/should-checklist-support-gfm-checkbox-syntax/163686/5 "2020-09-10T21:12:48Z")

</div>

> [@Discourse Checklist](https://meta.discourse.org/t/discourse-checklist/36362/193):
>
> This line should if the checkbox is in the first three characters of the line. I just checked the regex and it appears to match correctly.

Don’t checklists always start with a bullet marker (`*` or `-`) first [[1](https://github.github.com/gfm/#task-list-items-extension-), [2](https://docs.github.com/en/github/managing-your-work-on-github/about-task-lists#creating-task-lists)], so that the regex should match:  
`- [\*]`  
which means this gets skipped because it is not in the first three characters anymore.

> [@k4rtik](#):
>
> The pages I am seeing all have the checkboxes at the beginning of the line.

I later found other cases where I have nested checkboxes as well. So assuming they are the beginning of the line will also skip a lot of valid use cases.

PS: I realized the OP here does not use GFM checklist syntax (but only as of Aug 4 with the change to wiki by @sam), but I have been using that since forever. CommonMark spec that Discourse seems to refer to for markdown documentation [doesn’t seem to support checklists yet](https://talk.commonmark.org/t/support-for-gfm-like-checkboxes/2007). Is Discourse inventing its own variant of the checklist syntax? I would prefer sticking to the widely popular GFM syntax instead of diversifying it further.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [September 10, 2020, 9:30pm UTC](https://meta.discourse.org/t/should-checklist-support-gfm-checkbox-syntax/163686/6 "2020-09-10T21:30:24Z")

</div>

Provide a link to the GFM checklist syntax specification please?

---

<div class="post-metadata">

### Author: ![k4rtik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/k4rtik/32/119508_2.png) [@k4rtik](https://meta.discourse.org/u/k4rtik)
#### Post date: [September 10, 2020, 10:07pm UTC](https://meta.discourse.org/t/should-checklist-support-gfm-checkbox-syntax/163686/7 "2020-09-10T22:07:30Z")

</div>

I linked it above, but here it is again:

> **[5.3Task list items (extension) - GitHub Flavored Markdown Spec](https://github.github.com/gfm/#task-list-items-extension-)**
>
> GFM enables the tasklist extension, where an additional processing step is performed on list items.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [September 10, 2020, 11:48pm UTC](https://meta.discourse.org/t/should-checklist-support-gfm-checkbox-syntax/163686/8 "2020-09-10T23:48:07Z")

</div>

It looks correct to me here, pasting in the two examples from the above link:

```plaintext
- [] foo
- [x] bar

```

produces

- foo
- bar

and

```plaintext
- [x] foo
  - [] bar
  - [x] baz
- [] bim

```

produces

- foo
  - bar
  - baz

- bim

So I am not sure I see what the problem is? Can you be more specific?

---

<div class="post-metadata">

### Author: ![k4rtik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/k4rtik/32/119508_2.png) [@k4rtik](https://meta.discourse.org/u/k4rtik)
#### Post date: [September 11, 2020, 12:09am UTC](https://meta.discourse.org/t/should-checklist-support-gfm-checkbox-syntax/163686/9 "2020-09-11T00:09:54Z")

</div>

Sorry, this seems confusing because things have changed fairly recently. I am referring to the screenshot shown at the plugin page that does not show the bulleted checklist syntax (and that the rake migrate task doesn’t seem to support):

> [@Discourse Checklist](https://meta.discourse.org/t/discourse-checklist/36362/1):
>
> You can find the repo at [GitHub - discourse/discourse-checklist: A simple checklist rendering plugin for discourse](https://github.com/discourse/discourse-checklist)
> 
> ![image](https://global.discourse-cdn.com/meta/original/3X/9/9/998424669e1f314b4e0a77a4aa4f8719e5550c22.png)
> 
> ![image](https://global.discourse-cdn.com/meta/original/3X/0/5/05e17c56c7518e45458a11110a25b23c3713acfe.png)

Here’s the diff screenshot that made the change:

 ![Screen Shot 2020-09-10 at 7.08.35 PM](https://global.discourse-cdn.com/meta/original/3X/7/7/77fa7c238236450a1bec2bdeaffc4188c77ed31b.png)

It’s hard to see but the left side has bulleted checkboxes, but the current right side gets rid of the bullets, suggesting a different default checkbox syntax for new users.

* * *

Added later:

In other words, all of these are now supported using the checklist plugin:

```plaintext
[] first
-[] second
- [] third

```

rendered as

first  
- second

- third

while GFM _tasklist_ spec only allows for the third variant (as a _tasklist_ is a _list_):

> A [task list item](https://github.github.com/gfm/#task-list-item) is a [list item](https://github.github.com/gfm/#list-items) where the first block in it is a paragraph which begins with a [task list item marker](https://github.github.com/gfm/#task-list-item-marker) and at least one whitespace character before any other content.
> 
> A [task list item marker](https://github.github.com/gfm/#task-list-item-marker) consists of an optional number of spaces, a left bracket ( `[` ), either a whitespace character or the letter `x` in either lowercase or uppercase, and then a right bracket ( `]` ).

If one wants to conform to the GFM tasklist extension spec, then the first two should not be allowed and not promoted in the plugin documentation.

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [September 11, 2020, 12:01pm UTC](https://meta.discourse.org/t/should-checklist-support-gfm-checkbox-syntax/163686/10 "2020-09-11T12:01:21Z")

</div>

> [@k4rtik](#):
>
> If one wants to conform to the GFM tasklist extension spec, then the first two should not be allowed and not promoted in the plugin documentation.

Supporting the GFM case doesn’t mean not supporting the other cases. If you were to extrapolate that logic out it would necessitate lots of negative changes to the way Discourse handles all kinds of markdown formatting.

 ![flexibility](https://global.discourse-cdn.com/meta/original/3X/f/1/f195e0d8c2fc6277e50b1885fb77edd5eedd0542.png)

There are lots of apps which generate markdown checkboxes, it’s quite convenient to be able to paste lists into Discourse posts. What value is there in breaking compatibility?

---

<div class="post-metadata">

### Author: ![k4rtik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/k4rtik/32/119508_2.png) [@k4rtik](https://meta.discourse.org/u/k4rtik)
#### Post date: [September 13, 2020, 3:40pm UTC](https://meta.discourse.org/t/should-checklist-support-gfm-checkbox-syntax/163686/11 "2020-09-13T15:40:39Z")

</div>

One of the big issues with markdown is lack of a common standard (CommonMark is fixing that) and hence a variety of incompatible implementations. When there already exists a hugely popular check list extension in the form of GFM, why is there a need to invent another one? I was under the impression that Discourse devs were invested in CommonMark and standardization of markdown.

My issue is not with supporting alternate syntax, I believe in Postel’s law (even though I believe the above issue should have been taken into consideration when the latest syntax changes were done, ie, from `[*]` to `[x]`), it is with promoting an incompatible (with GFM) syntax in the plugin doc and not supporting easy migration of the GFM-like task list syntax to the newer format, which broke a lot of my pages on my Discourse instance, see my OP.

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [September 13, 2020, 4:07pm UTC](https://meta.discourse.org/t/should-checklist-support-gfm-checkbox-syntax/163686/12 "2020-09-13T16:07:17Z")

</div>

We did just make the change to make the syntax simpler. You can use `[]` anywhere in a post to make a checkbox. I don’t foresee us changing it again anytime soon. You’re more than welcome to create a fork of the plugin to implement what you desire, though.
