Skip to content

Bug with asterisks (if this is the current version of GFM on GitHub) #520

Closed

Description

@alanhogan

Sorry if this is filed incorrectly, but strings like this are not formatted correctly:

Test *italic here **bold italic here** and italic still* end

See also http://ajh.us/babelmark2-asterisks-bold-in-italic-test

Activity

  1. changed the title [-]Bug (if this is the current version of GFM on GitHub)[/-] [+]Bug with asterisks (if this is the current version of GFM on GitHub)[/+] on Dec 5, 2014
  2. CoDEmanX commented on Sep 4, 2015

    @CoDEmanX
  3. sunil-ideas2it commented on Jan 4, 2016

    @sunil-ideas2it

    Anyone got fix for this .

  4. joshbruce commented on Apr 13, 2018

    @joshbruce
    Member

    Closing as covered by spec-compliance. See also #1106 and #1216

  5. Feder1co5oave commented on Dec 5, 2018

    @Feder1co5oave
    Contributor

    This still fails:

    text text *five \*six* text
    <p>text text <em>five \</em>six* text</p>
  6. reopened this on Dec 6, 2018
  7. added
    L1 - broken
    on Dec 6, 2018
  8. rtxa commented on May 5, 2019

    @rtxa

    Hi, I've fixed this by not matching the backslash character in the regex for the 5th capturing group, this needs to be tested to ensure there aren't side effects. Check this Regex demo

    Original code:

    em: /^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,

    Fix:

    em: /^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s"<\[][\s\S]*?[^\s*\\])\*(?!\*)|^\*([^\s"<\[][\s\S]*?[^\s*\\])\*(?!\*)/,
  9. UziTech commented on May 6, 2019

    @UziTech
    Member

    @rtxa you should create a PR so it can be tested by our test suite

  10. lynzrand commented on Nov 2, 2020

    @lynzrand

    Sorry to dig up this issue, but is there any updates on this issue? Seems it's still present as of v1.2.2.

  11. UziTech commented on Nov 2, 2020

    @UziTech
    Member

    There are still some issues with em but it looks like the original bug is fixed:

    Test *italic here **bold italic here** and italic still* end
    
    <p>Test <em>italic here <strong>bold italic here</strong> and italic still</em> end</p>
    

    demo

    @01010101lzy if you have other markdown that is not working you can create a different issue.

  12. lynzrand commented on Nov 3, 2020

    @lynzrand

    There are still some issues with em but it looks like the original bug is fixed:

    Test *italic here **bold italic here** and italic still* end
    
    <p>Test <em>italic here <strong>bold italic here</strong> and italic still</em> end</p>
    

    demo

    @01010101lzy if you have other markdown that is not working you can create a different issue.

    The problem mentioned in the first reply of this issue (asterisks are not properly escaped) is still lying around unfortunately...

    https://marked.js.org/demo/?text=*test%5C*%20123*&options=%7B%20%22baseUrl%22%3A%20null%2C%20%22breaks%22%3A%20false%2C%20%22gfm%22%3A%20true%2C%20%22headerIds%22%3A%20true%2C%20%22headerPrefix%22%3A%20%22%22%2C%20%22highlight%22%3A%20null%2C%20%22langPrefix%22%3A%20%22language-%22%2C%20%22mangle%22%3A%20true%2C%20%22pedantic%22%3A%20false%2C%20%22sanitize%22%3A%20false%2C%20%22sanitizer%22%3A%20null%2C%20%22silent%22%3A%20false%2C%20%22smartLists%22%3A%20false%2C%20%22smartypants%22%3A%20false%2C%20%22tokenizer%22%3A%20null%2C%20%22walkTokens%22%3A%20null%2C%20%22xhtml%22%3A%20false%7D&version=master

  13. UziTech commented on Nov 3, 2020

    @UziTech
    Member

    @01010101lzy yes that is still an issue. If you want to you can create a different issue to track that bug. PRs are also welcome. 😁

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

    L1 - brokencategory: inline elements

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions