Open jonjanisch opened 4 years ago
Thanks for the report. I'll try take a look when I get a chance, but good to know there's a workaround in the meantime. Looks like the proper thing to do would be to consolidate the logic for handling both kinds of URL definitions.
I was mistaken about [description](url)
syntax working. It produces unmatched apostrophes.
"<p>Test: <a href='https://www.page.com/Bob's-page'>https://www.page.com/Bob's-page</a></p>"
If it used double quotes it would work fine:
"<p>Test: <a href="https://www.page.com/Bob's-page">https://www.page.com/Bob's-page</a></p>"
yeah there's not escaping happening in the parser
Hey. Clojure noob looking for an issue. Is this one up for grabs?
It sure is :)
Cool. I might need some help, but will dig into the code first.
Oh yeah sure thing, I can help point you in the right direction if you get stuck on anything.
The automatic link parser fails if URLs contains an apostrophe.
Plain URL
The automatic link normally takes a URL like this:
(md-to-html-string "Test: <https://www.google.com>")
And generates an anchor tag like this:
"<p>Test: <a href=\"https://www.google.com\">https://www.google.com</a></p>"
URL with apostrophe
But if the link contains an apostrophe:
(md-to-html-string "Test: <https://www.page.com/Bob's-page>")
It gets treated as plain text:
"<p>Test: <https://www.page.com/Bob's-page></p>"
Alternative syntax
[description](url)
works fine(md-to-html-string "Test: [https://www.page.com/Bob's-page](https://www.page.com/Bob's-page)")
"<p>Test: <a href='https://www.page.com/Bob's-page'>https://www.page.com/Bob's-page</a></p>"
I came across this while pasting some random github wiki page URLs into my app.