Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task lists are rendered even when GFM is disabled #1823

Closed
TheCloudlessSky opened this issue Nov 14, 2020 · 4 comments · Fixed by #1825 · 4 remaining pull requests
Closed

Task lists are rendered even when GFM is disabled #1823

TheCloudlessSky opened this issue Nov 14, 2020 · 4 comments · Fixed by #1825 · 4 remaining pull requests
Labels
category: lists good first issue Something easy to get started with L1 - broken Valid usage causes incorrect output OR a crash AND there is no known workaround for the issue released

Comments

@TheCloudlessSky
Copy link
Contributor

Marked version:

1.2.3

Describe the bug

Even when gfm: false, task lists are rendered.

To Reproduce

Steps to reproduce the behavior:

  1. Setup options with gfm: false.
  2. Render the following:
Unordered:

- [ ] A
- [ ] B
- [ ] C

Ordered:

1. [ ] A
2. [ ] B
3. [ ] C

A | B
--|--
1 | 2
3 | 4
5 | 6
  1. Confirm that the table is not rendered, but the task list is rendered:

image

Here's some demos:

Expected behavior

Task lists are only an extension of GFM, so I would expect the output to match CommonMark by using the [ ] as part of the rendered text:

image

@UziTech UziTech added category: lists L1 - broken Valid usage causes incorrect output OR a crash AND there is no known workaround for the issue labels Nov 15, 2020
@UziTech
Copy link
Member

UziTech commented Nov 15, 2020

Thanks for reporting this. Can you create a PR to fix this?

@UziTech UziTech added the good first issue Something easy to get started with label Nov 15, 2020
@UziTech
Copy link
Member

UziTech commented Nov 15, 2020

It looks like we just need to check for this.options.gfm around this code

marked/src/Tokenizer.js

Lines 280 to 286 in da071c9

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

@TheCloudlessSky
Copy link
Contributor Author

@UziTech sure thing: #1825.

UziTech added a commit that referenced this issue Nov 19, 2020
* Fix #1823 - task lists are rendered even when GFM is disabled.

* end file with a new line

Co-authored-by: Tony Brix <[email protected]>
github-actions bot pushed a commit that referenced this issue Nov 19, 2020
## [1.2.5](v1.2.4...v1.2.5) (2020-11-19)

### Bug Fixes

* fix em and strong starting with special char ([#1832](#1832)) ([f9bc93b](f9bc93b))
* task lists not rendered when GFM is disabled ([#1825](#1825)) ([3942e89](3942e89)), closes [#1823](#1823)
@github-actions
Copy link

🎉 This issue has been resolved in version 1.2.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: lists good first issue Something easy to get started with L1 - broken Valid usage causes incorrect output OR a crash AND there is no known workaround for the issue released
Projects
None yet
2 participants