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

Autolink incorrectly dropping tildes #423

Closed
Manishearth opened this issue Jun 26, 2024 · 5 comments · Fixed by #426
Closed

Autolink incorrectly dropping tildes #423

Manishearth opened this issue Jun 26, 2024 · 5 comments · Fixed by #426
Labels

Comments

@Manishearth
Copy link

GitHub recognizes colons and tildes in URLs which is used by the "link to text section" (#:~:text) url fragment specifier

https://www.unicode.org/review/pri453/feedback.html#:~:text=Fri%20Jun%2024%2009:56:01%20CDT%202022

I think the fix is just removing ~ and : from LINK_END_ASSORTMENT?

@Manishearth Manishearth changed the title Autolink incorrectly dropping tildes and colons Autolink incorrectly dropping tildes Jun 26, 2024
@Manishearth
Copy link
Author

I think strikethrough parsing is interfering with autolinking

@kivikakk
Copy link
Owner

Can you give me a full repro? Autolink and strikethrough both enabled, I don't have any trouble with the example given:

$ comrak --version
comrak 0.24.1
$ cat colon-tilde.md
Here's an autolink: https://www.unicode.org/review/pri453/feedback.html#:~:text=Fri%20Jun%2024%2009:56:01%20CDT%202022.
$ comrak -e autolink -e strikethrough colon-tilde.md
<p>Here's an autolink: <a href="https://www.unicode.org/review/pri453/feedback.html#:~:text=Fri%20Jun%2024%2009:56:01%20CDT%202022">https://www.unicode.org/review/pri453/feedback.html#:~:text=Fri%20Jun%2024%2009:56:01%20CDT%202022</a>.</p>

@Manishearth
Copy link
Author

Ah I think you need two such URLs in the same line

Here's an autolink: https://www.unicode.org/review/pri453/feedback.html#:~:text=Fri%20Jun%2024%2009:56:01%20CDT%202022 and another one https://www.unicode.org/review/pri453/feedback.html#:~:text=Fri%20Jun%2024%2009:56:01%20CDT%202022.

with comrak -e autolink -e strikethrough

@kivikakk
Copy link
Owner

Thanks! Confirmed. This will take some careful comparison of the behaviour of Comrak and cmark-gfm (where strikethrough is done via the extensions API). I wonder if its autolink is managing to trigger first and therefore skip strikethrough entirely — Comrak does autolink in a postprocessing step, which is why there are so many issues (#58 #382 #388) with it.

@kivikakk
Copy link
Owner

#426 addresses this! The solution was indeed to rework Comrak's autolinker to match cmark-gfm's in its structure (largely inline processed, with some postprocessing after).

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

Successfully merging a pull request may close this issue.

2 participants