Skip to content

italic html incorrectly rendered? #216

Closed

Description

@fyears

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". :-)

Activity

  1. greduan commented on Aug 7, 2013

    @greduan

    @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\_
    
  2. Mithgol commented on Aug 9, 2013

    @Mithgol
    Contributor

    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.

  3. Mithgol commented on Aug 9, 2013

    @Mithgol
    Contributor

    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.

  4. Mithgol commented on Aug 9, 2013

    @Mithgol
    Contributor

    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.

  5. javoire commented on Sep 22, 2014

    @javoire

    +1

  6. joshbruce commented on Dec 6, 2017

    @joshbruce
    Member

    Closing as stale. See #956

  7. Feder1co5oave commented on Jan 25, 2018

    @Feder1co5oave
    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>
    
  8. joshbruce commented on Apr 13, 2018

    @joshbruce
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions