Skip to content

Commit

Permalink
fix: task lists not rendered when GFM is disabled (#1825)
Browse files Browse the repository at this point in the history
* Fix #1823 - task lists are rendered even when GFM is disabled.

* end file with a new line

Co-authored-by: Tony Brix <tony@brix.ninja>
  • Loading branch information
TheCloudlessSky and UziTech committed Nov 19, 2020
1 parent 0f2bf42 commit 3942e89
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Tokenizer.js
Expand Up @@ -278,11 +278,13 @@ module.exports = class Tokenizer {
}

// Check for task list items
istask = /^\[[ xX]\] /.test(item);
ischecked = undefined;
if (istask) {
ischecked = item[1] !== ' ';
item = item.replace(/^\[[ xX]\] +/, '');
if (this.options.gfm) {
istask = /^\[[ xX]\] /.test(item);
ischecked = undefined;
if (istask) {
ischecked = item[1] !== ' ';
item = item.replace(/^\[[ xX]\] +/, '');
}
}

list.items.push({
Expand Down
5 changes: 5 additions & 0 deletions test/specs/new/list_tasks_non_gfm.html
@@ -0,0 +1,5 @@
<ul>
<li>[ ] A</li>
<li>[x] B</li>
<li>[ ] C</li>
</ul>
7 changes: 7 additions & 0 deletions test/specs/new/list_tasks_non_gfm.md
@@ -0,0 +1,7 @@
---
gfm: false
description: Task lists are ignored when not using GFM
---
- [ ] A
- [x] B
- [ ] C

1 comment on commit 3942e89

@vercel
Copy link

@vercel vercel bot commented on 3942e89 Nov 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.