Tony Brix

Results 613 comments of Tony Brix

A little bit more research shows tests in GFM with single tildes as strikethrough. https://github.com/github/cmark-gfm/blob/36c1553d2a1f04dc1628e76b18490edeff78b8d0/test/extensions.txt#L502-L510 It looks like this is a legacy issue. The spec was originally supposed to only...

This is how you could use an extension to override the current behavior: ```js const marked = require("marked"); marked.use({ tokenizer: { del(src) { const cap = /^~~+(?=\S)([\s\S]*?\S)~~+/.exec(src); if (cap) {...

It looks like the space token after the header is because of the spaces in the blank line. [demo without spaces](https://marked.js.org/demo/?outputType=lexer&text=%23%20header%20%0A%0Aparagraph%0A&options=%7B%0A%20%22baseUrl%22%3A%20null%2C%0A%20%22breaks%22%3A%20false%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=master) [demo with spaces](https://marked.js.org/demo/?outputType=lexer&text=%23%20header%20%0A%20%20%0Aparagraph%0A&options=%7B%0A%20%22baseUrl%22%3A%20null%2C%0A%20%22breaks%22%3A%20false%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=master) I agree the tokens should be...

It does if there are space characters in the blank line after the list just like a header. [demo](https://marked.js.org/demo/?outputType=lexer&text=%23%20header%20%0A%20%20%0Aparagraph%0A%0A-%20one%0A-%20two%0A%20%20%0AParagraph&options=%7B%0A%20%22baseUrl%22%3A%20null%2C%0A%20%22breaks%22%3A%20false%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=master)

As I said above, I agree they should be more consistent. We always appreciate PRs 😁👍

Just curious what you use the tokens for? It seems like you should be able to just skip the space tokens since they don't affect rendering.

L2-annoying just means it is a low priority bug.

You will need to write a function that fetches the file and sends the text into marked. Something like: ```js async function markedFile(file) { const res = await fetch(file) const...

the slug function is exposed https://github.com/markedjs/marked/blob/5d727cb020fd9c748b228066f44f8a34828cc17b/lib/marked.js#L1685

You can get the slug function from ``` const slugger = new marked.Slugger(); slugger.slug(...) ```