Skip to content

URLs with parentheses are not converting properly. #619

Closed

Description

@Pomax

Using the following markup:

[青 ("ao")](https://en.wikipedia.org/wiki/Ao_(color))

leads to a link that actually looks like 青 ("ao")) with the link's own parenthesis getting cut off (marked seems to be treating the first ) it sees as link terminator, instead of taking nesting into account)

Activity

  1. rgbkrk commented on Jul 15, 2015

    @rgbkrk

    Definitely an issue, that I see happening across the web from users of marked.

  2. bendecoste commented on Jul 23, 2015

    @bendecoste

    Is there an ETA for a fix on this ?

  3. Pomax commented on Jul 23, 2015

    @Pomax
    Author

    I have no expectation that @chjj will ever fix this, but it's mostly a bug that stems from a bad assumption in https://github.com/chjj/marked/blob/master/lib/marked.js#L467, which is terminal: unless someone introduces a "respect nesting" operator to JavaScript's RegEx engine, it is impossible to user regular expressions in a way that properly deals with blocks/nesting.

    (which is why we typically don't parse structure syntax with regex, but with tokenizers instead)

    I was thinking of trying to fix this, but "fix" in this case means "write a new parser that doesn't rely on regex", and that's not happening. So: if you need links in which the URI contains (), don't use marked.js

  4. Pomax commented on Jul 23, 2015

    @Pomax
    Author

    filed #630 as PR to at least make it explicit that this is a pure RegEx parser, with all the limitations that brings with it.

  5. joshbruce commented on Dec 25, 2017

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