Skip to content

Link href with parens generates incorrect ast #4

@zeusdeux

Description

@zeusdeux

Hey! Thanks for a great package!
The application I'm working on ran into this issue recently where if the href for a link contains non url encoded parens (()), the ast node generated for the link doesn't contain the full href.

marked-ast version: 0.3.0

Steps to reproduce:

  1. Invoke MarkedAst._marked like so —
MarkedAst._marked('[Some link](https://something.xyz/(12)/1)', {
      // use renderer with altered methods for links and images
      renderer: new MarkedAst.AstBuilder(),
      // turn on Github-flavored MD goodies
      gfm: true,
      tables: true,
      breaks: true,
      smartypants: true,
      sanitize: false
    });

Expected ast:

[
  {
    "type": "paragraph",
    "text": [
      {
        "type": "link",
        "href": "https://something.xyz/(12)/1",
        "title": null,
        "text": [
          "Some link"
        ]
      }
    ]
  }
]

Received/Actual:

[
  {
    "type": "paragraph",
    "text": [
      {
        "type": "link",
        "href": "https://something.xyz/(12",
        "title": null,
        "text": [
          "Some link"
        ]
      },
      "/1)"
    ]
  }
]

Any ideas on how we can resolve this?
Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions