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

italic html incorrectly rendered? #216

Closed
fyears opened this issue Aug 3, 2013 · 8 comments
Closed

italic html incorrectly rendered? #216

fyears opened this issue Aug 3, 2013 · 8 comments

Comments

@fyears
Copy link

fyears commented Aug 3, 2013

I don't know whether it should be considered a bug or a feature.

I've enabled gfm while using the marked function.

When the markdown text is:

abc_def ghi

abc_def ghi_

the html text rendered by marked is

<p>abc_def ghi</p><p>abc<em>def ghi</em></p>

But, I think the "correct" html should be:

<p>abc_def ghi</p><p>abc_def ghi_</p>

It's a conflict caused by gfm and original markdown syntax. Maybe you guys (developers of marked) should consider which result is "more correct". :-)

@greduan
Copy link

greduan commented Aug 7, 2013

@chjj 👍 I support this change. It's a really basic but very important change. :)

For a possible markdown it might be wise to just escape these underscores:

abc\_def ghi\_

@Mithgol
Copy link
Contributor

Mithgol commented Aug 9, 2013

GitHub-flavoured Markdown has docs and they say that underscores inside words are ignored (there's a reason for that: GitHub is a coding site, and words with underscores are likely to be snake-cased identifiers from some code).

In order to imitate GFM perfectly, marked should ignore such underscores (in GFM mode) as well.

@Mithgol
Copy link
Contributor

Mithgol commented Aug 9, 2013

However, I have to admit (additionally) that the corresponding section of GFM docs is titled “Multiple underscores in words” and nothing is said about single underscores.

@Mithgol
Copy link
Contributor

Mithgol commented Aug 9, 2013

But the GitHub devs have (most probably) just forgotten to mention that single underscores are ignored in words as well as multiple underscores.

A simple test (i.e. pasting abc_def ghi_ in a GitHub comment and then hitting the “Preview” tab) shown that's indeed the case.

@javoire
Copy link

javoire commented Sep 22, 2014

+1

@joshbruce
Copy link
Member

joshbruce commented Dec 6, 2017

Closing as stale. See #956

@Feder1co5oave
Copy link
Contributor

This is still all too real, unfortunately:

bin/marked 
abc_def ghi

abc_def ghi_
^D

<p>abc_def ghi</p>
<p>abc<em>def ghi</em></p>

@joshbruce
Copy link
Member

Closing as covered by CommonMark compliance. See #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

6 participants