marked-ast
marked-ast copied to clipboard
Link href with parens generates incorrect ast
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:
- Invoke
MarkedAst._markedlike 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!
Have you tried testing with the latest version of marked? If it parsely properly there, then it can probably be solved by updating this package to use the new version.
Just did and marked.parse('[Some link](https://something.xyz/(12)/1)') returns '<p><a href="https://something.xyz/(12)/1">Some link</a></p>\n' which looks correct so maybe the update in this package would work! ^_^
I've tried updating this package but it's incredibly hard as all the tests fail as soon as I switch to a newer version of marked. Could you help with that @pdubroy?
@zeusdeux Looks like you need to copy the tests from marked too. npm run update-tests should do it.