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

Problem with colons that are not part of the syntax #3

Open
Connum opened this issue Sep 17, 2018 · 2 comments
Open

Problem with colons that are not part of the syntax #3

Connum opened this issue Sep 17, 2018 · 2 comments

Comments

@Connum
Copy link

Connum commented Sep 17, 2018

There's an issue when the text contains colons that are not part of the span syntax. In that case, the colon character gets duplicated.

var rendered = md.render('This is a :span with **bold**::');

expected output:

<p>This is a <span>span with <strong>bold</strong></span>:</p>

actual output:

<p>This is a <span>span with <strong>bold</strong></span>::</p>

see https://jsfiddle.net/eg5La2nq/21/

When you change

  token.content = ch + ch;

to

  token.content = ch;

in the for-loop of the tokenize function, the output is as intended.

https://jsfiddle.net/eg5La2nq/23/

But I wonder why that line has been this way in the first place?

@oshihirii
Copy link

oshihirii commented Oct 15, 2018

This seems to be related to the issue here (which I am seeking fix for):

#1

@Connum - is the solution you mentioned at the following line?

https://github.com/pnewell/markdown-it-span/blob/master/index.js#L30

@mmilczewski - is this the same solution you came up with?

How can we update this repo and the npm package with fix?

@oshihirii
Copy link

For reference, I added one possible solution here:

markdown-it/markdown-it#508 (comment)

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

2 participants