Skip to content

Commit 3942e89

Browse files
fix: task lists not rendered when GFM is disabled (#1825)
* Fix #1823 - task lists are rendered even when GFM is disabled. * end file with a new line Co-authored-by: Tony Brix <[email protected]>
1 parent 0f2bf42 commit 3942e89

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

src/Tokenizer.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,13 @@ module.exports = class Tokenizer {
278278
}
279279

280280
// Check for task list items
281-
istask = /^\[[ xX]\] /.test(item);
282-
ischecked = undefined;
283-
if (istask) {
284-
ischecked = item[1] !== ' ';
285-
item = item.replace(/^\[[ xX]\] +/, '');
281+
if (this.options.gfm) {
282+
istask = /^\[[ xX]\] /.test(item);
283+
ischecked = undefined;
284+
if (istask) {
285+
ischecked = item[1] !== ' ';
286+
item = item.replace(/^\[[ xX]\] +/, '');
287+
}
286288
}
287289

288290
list.items.push({
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ul>
2+
<li>[ ] A</li>
3+
<li>[x] B</li>
4+
<li>[ ] C</li>
5+
</ul>

test/specs/new/list_tasks_non_gfm.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
gfm: false
3+
description: Task lists are ignored when not using GFM
4+
---
5+
- [ ] A
6+
- [x] B
7+
- [ ] C

0 commit comments

Comments
 (0)