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

GFM underscore parsing is broken #491

Closed
javoire opened this issue Sep 22, 2014 · 8 comments
Closed

GFM underscore parsing is broken #491

javoire opened this issue Sep 22, 2014 · 8 comments

Comments

@javoire
Copy link

javoire commented Sep 22, 2014

To recap on_our_use_case

becomes
screen shot 2014-09-22 at 13 43 11

And it shouldn't, according to https://help.github.com/articles/github-flavored-markdown#multiple-underscores-in-words. The result should be the same as the input:

To recap on_our_use_case

Cheers,
JD

@javoire
Copy link
Author

javoire commented Sep 22, 2014

Also, this
screen shot 2014-09-22 at 13 48 42
becomes
screen shot 2014-09-22 at 13 48 53

Should be:

variable_with_underscores = 1

Fix hack (one back slash):
screen shot 2014-09-22 at 13 56 33
screen shot 2014-09-22 at 13 56 37

@javoire
Copy link
Author

javoire commented Sep 22, 2014

lastly:
screen shot 2014-09-22 at 13 51 45
becomes:
screen shot 2014-09-22 at 13 52 01

Fix hack (two backslashes):

[http://example.com/link\\_with\\_underscore](http://example.com/link_with_underscore)

cheers!

@javoire
Copy link
Author

javoire commented Sep 22, 2014

the behaviour is not consistent though. In some of our markdown files (with more code blocks and heavier markup) this behaviour is shown, and in others (usually lighter markup) it works as expected. I'll update here when I know more

@javoire
Copy link
Author

javoire commented Sep 22, 2014

Allright, I've finally narrowed a reproducable setup.
So this:

Lorem_ipsum dolor sit amet, __consectetur adipisicing__ elit. Voluptatem a __ea voluptas nihil__ error modi.
Lorem_ipsum dolor sit amet, **consectetur adipisicing** elit. Voluptatem a **ea voluptas nihil** error modi.

Should result in this:
Lorem_ipsum dolor sit amet, consectetur adipisicing elit. Voluptatem a ea voluptas nihil error modi.
Lorem_ipsum dolor sit amet, consectetur adipisicing elit. Voluptatem a ea voluptas nihil error modi.
(e.g. identical, docs)

But instead it results in this:
screen shot 2014-09-22 at 19 49 23

Reproduce steps

  1. input.md:
Lorem_ipsum dolor sit amet, __consectetur adipisicing__ elit. Voluptatem a __ea voluptas nihil__ error modi.
Lorem_ipsum dolor sit amet, **consectetur adipisicing** elit. Voluptatem a **ea voluptas nihil** error modi.
  1. run marked:
marked -i input.md -o output.html
  1. output.html
<p>Lorem<em>ipsum dolor sit amet, <strong>consectetur adipisicing</strong> elit. Voluptatem a <em>_ea voluptas nihil</em></em> error modi.</p>
<p>Lorem_ipsum dolor sit amet, <strong>consectetur adipisicing</strong> elit. Voluptatem a <strong>ea voluptas nihil</strong> error modi.</p>

Cheers

@javoire
Copy link
Author

javoire commented Sep 22, 2014

This one also produces wrong output:
in

Lorem_ipsum_dolor sit_amet, consectetur adipisicing elit. _[laborum rerum](laborum rerum)_

out

<p>Lorem<em>ipsum_dolor sit_amet, consectetur adipisicing elit. </em><a href="laborum rerum">laborum rerum</a>_</p>

@notatestuser
Copy link

I have one too:

while this is correct

$ marked
{{some_test_thing}}
<p>{{some_test_thing}}</p>

this is not

$ marked
{{some_test_thing}} _another_ thing
<p>{{some<em>test_thing}} _another</em> thing</p>

@Feder1co5oave
Copy link
Contributor

Feder1co5oave commented Jan 25, 2018

Can't reproduce this at 33b444c

edit: I can reproduce this though.

bin/marked 
Lorem_ipsum_dolor sit_amet, consectetur adipisicing elit. _[laborum rerum](laborum rerum)_
<p>Lorem_ipsum_dolor sit<em>amet, consectetur adipisicing elit. </em><a href="laborum rerum">laborum rerum</a>_</p>

@joshbruce
Copy link
Member

Closing as I believe this will be fixed via spec-compliance. See #1106 and #1216

@styfle styfle closed this as completed Apr 17, 2018
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

5 participants