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 is broken in Goldmark when link contains underscore #6932

Closed
tdelmas opened this issue Feb 22, 2020 · 3 comments
Closed

Autolink is broken in Goldmark when link contains underscore #6932

tdelmas opened this issue Feb 22, 2020 · 3 comments
Labels

Comments

@tdelmas
Copy link

tdelmas commented Feb 22, 2020

What version of Hugo are you using (hugo version)?

$ hugo version
Hugo Static Site Generator v0.65.2/extended windows/amd64 BuildDate: unknown

Does this issue reproduce with the latest release?

Yes

With Blackfriday (defaultMarkdownHandler = "blackFriday") a markdown page with the text "https://safebrowsing.google.com/safebrowsing/report_badware/" generate correctly an html page with <a href="https://safebrowsing.google.com/safebrowsing/report_badware/">https://safebrowsing.google.com/safebrowsing/report_badware/</a>

But with Goldmark the html generated is : <a href="https://safebrowsing.google.com/safebrowsing/report/">https://safebrowsing.google.com/safebrowsing/report/</a>_badware : The end "_badware" is considered outside the link.

@satotake
Copy link
Contributor

satotake commented Feb 22, 2020

Reproduced with Hugo Static Site Generator v0.65.2/extended darwin/amd64

In your (internationalized!) site, there are 2 types of Autolink with underscore.

One is with \.
The other is without \

While the former is broken, the latter works fine even with goldmark.

./content/sv/docs/faq.md
74:https://safebrowsing.google.com/safebrowsing/report\_badware/

./content/zh-cn/docs/faq.md
52:https://safebrowsing.google.com/safebrowsing/report\_badware/

./content/ru/docs/faq.md
53:https://safebrowsing.google.com/safebrowsing/report\_badware/

./content/ja/docs/faq.md
52:https://www.google.com/safebrowsing/report_badware/

./content/pt-br/docs/faq.md
52:https://www.google.com/safebrowsing/report_badware/

./content/de/docs/faq.md
52:https://www.google.com/safebrowsing/report_badware/

./content/zh-tw/docs/faq.md
51:https://www.google.com/safebrowsing/report_badware/

./content/es/docs/faq.md
52:https://www.google.com/safebrowsing/report_badware/

./content/en/docs/faq.md
51:https://safebrowsing.google.com/safebrowsing/report_badware/

Your point is right.
This means that there is difference between goldmark's behavior and blackfriday's about handling backslash.
However, in this case, I recommend that you replace report\_badware with report_badware because these backslashes are essentially not needed.

How about removing backslashes? @tdelmas

@tdelmas
Copy link
Author

tdelmas commented Feb 22, 2020

@satotake thank you for noticing the backslash, I missed it!

The conclusion is yes, there are differences goldmark's behavior and blackfriday's about handling backslash but not only: I found some links surrounding by Chinese punctuation that were not converted. I'm fixing all those links to be explicit links.

@tdelmas tdelmas closed this as completed Feb 22, 2020
@github-actions
Copy link

github-actions bot commented Feb 6, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants