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

Crash on table like content in heading, followed by a list with continuation #2278

Closed
ChristianMurphy opened this issue Nov 11, 2021 · 3 comments

Comments

@ChristianMurphy
Copy link

ChristianMurphy commented Nov 11, 2021

Marked version:

4.0.1

Describe the bug

Marked crashes when parsing file with error TypeError: Cannot read properties of undefined (reading 'trim')

To Reproduce

write the following file to test.js

const marked = require("marked");

const source = `\\|
-
*
	`

console.log(marked.parse(source));

run node test.js

result is

marked/lib/marked.cjs:2600
      throw e;
      ^

TypeError: Cannot read properties of undefined (reading 'trim')
Please report this to https://github.com/markedjs/marked.

Issue can also be seen in the demo
https://marked.js.org/demo/?text=%5C%7C%0A-%0A*%0A%09&options=%7B%0A%20%22baseUrl%22%3A%20null%2C%0A%20%22breaks%22%3A%20false%2C%0A%20%22extensions%22%3A%20null%2C%0A%20%22gfm%22%3A%20true%2C%0A%20%22headerIds%22%3A%20true%2C%0A%20%22headerPrefix%22%3A%20%22%22%2C%0A%20%22highlight%22%3A%20null%2C%0A%20%22langPrefix%22%3A%20%22language-%22%2C%0A%20%22mangle%22%3A%20true%2C%0A%20%22pedantic%22%3A%20false%2C%0A%20%22sanitize%22%3A%20false%2C%0A%20%22sanitizer%22%3A%20null%2C%0A%20%22silent%22%3A%20false%2C%0A%20%22smartLists%22%3A%20false%2C%0A%20%22smartypants%22%3A%20false%2C%0A%20%22tokenizer%22%3A%20null%2C%0A%20%22walkTokens%22%3A%20null%2C%0A%20%22xhtml%22%3A%20false%0A%7D&version=4.0.1

Expected behavior

No error is thrown (https://spec.commonmark.org/dingus/?text=%5C%7C%0A-%0A*%0A%09)

@ChristianMurphy
Copy link
Author

ChristianMurphy commented Nov 11, 2021

The issue appears to be specific to GFM mode (demo example without GFM)
It appears to affect releases between 3.0.0-4.0.1 (demo example with 3.0.0)

@calculuschild
Copy link
Contributor

I suspect this is the same issue as #2249

@UziTech
Copy link
Member

UziTech commented Nov 12, 2021

ya this seems like a duplicate of #2249

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants