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

strikethrough broken #286

Closed
bsaelim opened this issue Nov 13, 2013 · 3 comments
Closed

strikethrough broken #286

bsaelim opened this issue Nov 13, 2013 · 3 comments
Labels
help wanted L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue

Comments

@bsaelim
Copy link

bsaelim commented Nov 13, 2013

some text is no longer working.

@joshbruce joshbruce added help wanted L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue labels Dec 6, 2017
@r0the
Copy link

r0the commented Feb 2, 2018

I had the same issue, but only when using marked as described under "Pro level", so I investigated a bit:

This works as expected:

console.log(marked('~~strikethrough~~'));

and renders as:

<p><del>strikethrough</del></p>

When using the lexer and parser separately with a custom renderer, the following code

var tokens = marked.lexer('~~strikethrough~~', {renderer: myRenderer});
console.log(marked.parser(tokens, {renderer: myRenderer}));

ignores the strikethrough and produces:

<p>~~strikethrough~~</p>

As far as I can see, the marked.parser method seems to ignore the gfm: true default. The following code:

var tokens = marked.lexer('~~strikethrough~~', {renderer: myRenderer});
console.log(marked.parser(tokens, {renderer: myRenderer, gfm: true}));

outputs <p><del>strikethrough</del></p> again as expected.

So my issue here is that marked.parser() doesn't respect the default options.

I have no idea if that is the same issue of @bsaelim, but it may be an explanation.

@r0the
Copy link

r0the commented Feb 2, 2018

I think the issue as I described it may be resolved by pull request #1015.

@Feder1co5oave
Copy link
Contributor

I confirm #1015 solves this issue, but it has a performance problem if you call marked several times. For now, remember to do something like this:

var marked = require('marked');
var myRenderer = new marked.Renderer();
marked.setOptions({ renderer: myRenderer });
var tokens = var tokens = marked.lexer('~~strikethrough~~');
console.log(marked.parser(tokens));

outputs

<p><del>strikethrough</del></p>

I'm closing this in favor of the linked PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue
Projects
None yet
Development

No branches or pull requests

4 participants