Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apostrophe in URL causes parser to fail to parse automatic links #156

Open
jonjanisch opened this issue Sep 16, 2019 · 7 comments
Open

Apostrophe in URL causes parser to fail to parse automatic links #156

jonjanisch opened this issue Sep 16, 2019 · 7 comments

Comments

@jonjanisch
Copy link

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.

@yogthos
Copy link
Owner

yogthos commented Sep 16, 2019

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.

@jonjanisch
Copy link
Author

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>"

@yogthos
Copy link
Owner

yogthos commented Sep 19, 2019

yeah there's not escaping happening in the parser

@caio-a-garcia
Copy link

Hey. Clojure noob looking for an issue. Is this one up for grabs?

@yogthos
Copy link
Owner

yogthos commented Jan 18, 2022

It sure is :)

@caio-a-garcia
Copy link

Cool. I might need some help, but will dig into the code first.

@yogthos
Copy link
Owner

yogthos commented Jan 18, 2022

Oh yeah sure thing, I can help point you in the right direction if you get stuck on anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants