Skip to content

Commit

Permalink
[Markdown] Add GitHub list checkboxes (#2249)
Browse files Browse the repository at this point in the history
Fixes #2248
  • Loading branch information
michaelblyons committed Jul 15, 2020
1 parent fb58dc8 commit 86ff51d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Markdown/Markdown.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,12 @@ contexts:
- include: table
- match: ''
pop: true
- match: '^([ ]{0,3})([*+-])(?=\s)'
- match: ^([ ]{0,3})([*+-])( (\[[ xX]\]))?(?=\s)
captures:
1: markup.list.unnumbered.markdown
2: markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown
3: markup.list.unnumbered.markdown
4: constant.language.checkbox.markdown-gfm
push:
- meta_content_scope: markup.list.unnumbered.markdown
- match: ^(?=\S)
Expand Down Expand Up @@ -987,10 +989,12 @@ contexts:
push:
- match: ^\s*$
pop: true
- match: '([ ]*)([*+-])(?=\s)'
- match: ([ ]*)([*+-])( (\[[ xX]\]))?(?=\s)
captures:
1: markup.list.unnumbered.markdown
2: markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown
3: markup.list.unnumbered.markdown
4: constant.language.checkbox.markdown-gfm
push:
- clear_scopes: 1
- meta_content_scope: markup.list.unnumbered.markdown meta.paragraph.list.markdown
Expand Down
18 changes: 18 additions & 0 deletions Markdown/syntax_test_markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,24 @@ because it doesn't begin with the number one:
* list continues
| <- markup.list.unnumbered punctuation.definition.list_item - markup.raw.block
* list continues
* [ ] Unticked GitHub-flavored-markdown checkbox
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered
| ^^^ constant.language.checkbox
* [x] Ticked GFM checkbox
| ^^^ constant.language.checkbox
* [X] Another ticked checkbox
| ^^^ constant.language.checkbox
+ [ ] Sub-item with checkbox
| ^^^ constant.language.checkbox
* [] Not a checkbox
| ^^^^^^^^^^^^^^^^^ - storage - constant
* [/] Not a checkbox
| ^^^^^^^^^^^^^^^^^^ - storage
* Not [ ] a [x] checkbox [X]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - storage - constant
* [ ] [Checkbox][] with next word linked
| ^^^ constant.language.checkbox
| ^^^^^^^^^^^^ meta.link

- `code` - <a name="demo"></a>
| ^ markup.list.unnumbered meta.paragraph.list markup.raw.inline punctuation.definition.raw
Expand Down

0 comments on commit 86ff51d

Please sign in to comment.