erusev / parsedown

Better Markdown Parser in PHP
https://parsedown.org
MIT License
14.74k stars 1.12k forks source link

Emphasis should not work inside word #703

Open adam-boduch opened 5 years ago

adam-boduch commented 5 years ago

Input: method_dot_.net Output in parsedown: methoddot.net Expected output: methoddot.net (just like other markdown implementations including github's).

douglasawh commented 5 years ago

@adam-boduch what's the html look like on these? I am trying to track down an issue in emails our application is sending out. I don't really think it is a Parsedown issue, but we are getting tags in places we don't expect them.

adam-boduch commented 5 years ago

It is parsedown issue. Take a look at: https://parsedown.org/demo

Type method_dot_.net and Click Parse. Do the same here on Github and compare results.

douglasawh commented 5 years ago

@adam-boduch Our code doesn't do it consistently, which suggests we are seeing something different. I think there is a bug in our logic. I wonder though if for some reason some of them are going through parsedown and others are not. That might explain the issue!

domsson commented 5 years ago

Adding to this that the behavior definitely seems inconsistent. Try using emphasis two times in the same word, like this: a_we_so_me_

The first set of underscores appears verbatim in the word, the second set creates emphasis for "me":

<p>a_we_so<em>me</em></p>

Checking Babelmark, it seems that the majority of implementations (including commonmark) do not create any emphasis and simply display all four underscores:

<p>a_we_so_me_</p>

Interestingly enough, using asterisks instead of underscores emphasizes both parts for the majority of implementations (including Parsedown); I didn't have the time to read and understand the CommonMark spec in order to figure out if all of this is the expected behavior.