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

Italics failing under certain cases #298

Closed
AmarPrabhu opened this issue Dec 2, 2013 · 7 comments
Closed

Italics failing under certain cases #298

AmarPrabhu opened this issue Dec 2, 2013 · 7 comments

Comments

@AmarPrabhu
Copy link

Italics fails under many conditions:

  • The markdown this is a simple _italics _without space <br> should yield HTML:

<p>this is a simple <em>italics </em>without space <br></p>

(as per http://daringfireball.net/projects/markdown/dingus)

instead marked gives me: <p>this is a simple _italics _without space <br></p>

  • Another example of the same happening:
    Markdown: this is another _italics_without space
    Exp result: <p>this is another <em>italics</em>without space<br></p>
    Marked result: <p>this is another _italics_without space<br></p>
  • Sometimes the parsing is completely broken:
    Markdown:

this is a simple _italics _without space <br> this is another _italics_without space<br> this is yet another _italics_ with space<br>

should yield:

<p>this is a simple <em>italics </em>without space <br>
this is another <em>italics</em>without space<br>
this is yet another <em>italics</em> with space<br></p>

Marked yields:

<p>this is a simple <em>italics _without space <br>
this is another _italics_without space<br>
this is yet another _italics</em> with space<br></p>
@ghost
Copy link

ghost commented Dec 2, 2013

This is my options with https://github.com/chjj/marked/blob/ab84e8c6055b020f29134b93c86a9ae2ce955706/lib/marked.js:

{
  gfm: false,
  tables: false,  //need gfm
  breaks: false,  //need gfm
  pedantic: false,  // if it is true, my examples below will fail
  sanitize: true,  // if it is false, my examples below will fail
  smartLists: false,
  smartypants: false,
}

I found it even more strange:

this is another _italics _without space <br> becomes <p>this is another _italics _without space &lt;br&gt;</p> (nope)

this is another *italics *without space <br> becomes <p>this is another <em>italics </em>without space &lt;br&gt;</p> (yep)

this is another _italics_without space becomes <p>this is another _italics_without space</p> (nope)

this is another *italics*without space becomes <p>this is another <em>italics</em>without space</p> (yep)

Your example above is different with "*":

this is a simple *italics *without space <br>
this is another *italics*without space<br>
this is yet another *italics* with space<br>

becomes:

<p>this is a simple <em>italics </em>without space &lt;br&gt;
this is another <em>italics</em>without space&lt;br&gt;
this is yet another <em>italics</em> with space&lt;br&gt;</p>

@AmarPrabhu
Copy link
Author

I just used the current library as is - no changes to the config. So * seems to be working fine huh. Let me give it a try and let you know. Thanks for the quick response.

@adam-p
Copy link

adam-p commented Dec 3, 2013

I did some tests with the MD dingus and with Marked with {gfm: false, pedantic: true} (which seem most original MD-ish).

this is a simple _italics _without space <br>
dingus: <p>this is a simple _italics _without space <br></p>
marked: <p>this is a simple _italics _without space <br></p>

this is another _italics_without space
dingus: <p>this is another <em>italics</em>without space</p>
marked: <p>this is another <em>italics</em>without space</p>

this is another _italics_without space<br>
dingus: <p>this is another <em>italics</em>without space<br></p>
marked: <p>this is another <em>italics</em>without space<br></p>

this is yet another _italics_ with space<br>
dingus: <p>this is yet another <em>italics</em> with space<br></p>
marked: <p>this is yet another <em>italics</em> with space<br></p>

So... looks to me like Marked is pretty accurate.

@AmarPrabhu
Copy link
Author

I disagree @adam-p : Dingus does not produce the same results you have mentioned.

MD: this is a simple _italics _without space <br>
Dingus: <p>this is a simple <em>italics </em>without space <br></p>
Marked: <p>this is a simple _italics _without space<br></p>

Here is a screenshot of the output in Dingus:
dingus

Here's another example:
MD: this is another _italics_without space
Dingus: <p>this is another <em>italics</em>without space</p>
Marked: <p>this is another _italics_without space</p>
Output in Dingus:
dingus2

@AmarPrabhu
Copy link
Author

I tried * for italics and __ for bold and that seems to do the trick. The parsing works fine for that combination of the markdown spec. However I think the opposite combination - _ for italics and ** for bold needs work in marked.

@adam-p
Copy link

adam-p commented Dec 5, 2013

I dunno, man, I dunno.

My dingus from the first:
screen shot 2013-12-04 at 9 26 01 pm

My Marked from the second:
screen shot 2013-12-04 at 9 31 19 pm

And now I'm just going to back out of this discussion...

@joshbruce
Copy link
Member

Closing as most likely covered by CommonMark compliance. See also #1106 and #1216

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

3 participants