Autolink does not show the full text #313

Closed
opened 2026-01-29 14:33:34 +00:00 by claunia · 2 comments
Owner

Originally created by @yishengjin1413 on GitHub (Jul 16, 2019).

For the following example, Autolink does not show the full text.

https://blogs.windows.com/windowsexperience/2017/01/23/Introducing-Windows-Defender-Security-Center/\#m4mv5W0GYKZpGvfA.97

BabelMark result :

<p>
  <a href="https://blogs.windows.com/windowsexperience/2017/01/23/Introducing-Windows-Defender-Security-Center/#m4mv5W0GYKZpGvfA.97">https://blogs.windows.com/windowsexperience/2017/01/23/Introducing-Windows-Defender-Security-Center/\#m4mv5W0GYKZpGvfA.9</a>
</p>

The link url is right but the link text missing the ending 7.

Originally created by @yishengjin1413 on GitHub (Jul 16, 2019). For the following example, Autolink does not show the full text. ``` https://blogs.windows.com/windowsexperience/2017/01/23/Introducing-Windows-Defender-Security-Center/\#m4mv5W0GYKZpGvfA.97 ``` [BabelMark result](https://babelmark.github.io/?text=https%3A%2F%2Fblogs.windows.com%2Fwindowsexperience%2F2017%2F01%2F23%2FIntroducing-Windows-Defender-Security-Center%2F%5C%23m4mv5W0GYKZpGvfA.97) : ``` <p> <a href="https://blogs.windows.com/windowsexperience/2017/01/23/Introducing-Windows-Defender-Security-Center/#m4mv5W0GYKZpGvfA.97">https://blogs.windows.com/windowsexperience/2017/01/23/Introducing-Windows-Defender-Security-Center/\#m4mv5W0GYKZpGvfA.9</a> </p> ``` The link url is right but the link text missing the ending `7`.
claunia added the bug label 2026-01-29 14:33:34 +00:00
Author
Owner

@MihaZupan commented on GitHub (Jul 16, 2019):

The issue here is the difference between the definition of a regular link and an autolink.
CommonMark states that backslashes will not work in autolinks (but will in links).

@yishengjin1413 As this is an Autolink, this means that the backslash in this case is not discarded but percent-encoded.

I believe the correct HTML for this markdown is

<p><a href="https://blogs.windows.com/windowsexperience/2017/01/23/Introducing-Windows-Defender-Security-Center/%5C#m4mv5W0GYKZpGvfA.97">https://blogs.windows.com/windowsexperience/2017/01/23/Introducing-Windows-Defender-Security-Center/\#m4mv5W0GYKZpGvfA.97</a></p>

In your example, the URL https://blogs.windows.com/windowsexperience/2017/01/23/Introducing-Windows-Defender-Security-Center/%5C#m4mv5W0GYKZpGvfA.97 will not be recognised as valid on the server anymore.

@MihaZupan commented on GitHub (Jul 16, 2019): The issue here is the difference between the definition of a regular link and an autolink. CommonMark states that backslashes will not work in autolinks (but will in links). @yishengjin1413 As this is an Autolink, this means that the backslash in this case is not discarded but percent-encoded. I believe the correct HTML for this markdown is ```html <p><a href="https://blogs.windows.com/windowsexperience/2017/01/23/Introducing-Windows-Defender-Security-Center/%5C#m4mv5W0GYKZpGvfA.97">https://blogs.windows.com/windowsexperience/2017/01/23/Introducing-Windows-Defender-Security-Center/\#m4mv5W0GYKZpGvfA.97</a></p> ``` In your example, the URL `https://blogs.windows.com/windowsexperience/2017/01/23/Introducing-Windows-Defender-Security-Center/%5C#m4mv5W0GYKZpGvfA.97` will not be recognised as valid on the server anymore.
Author
Owner

@yishengjin1413 commented on GitHub (Jul 17, 2019):

@MihaZupan Make sense. Thanks for your explanation and fixing the bug.

@yishengjin1413 commented on GitHub (Jul 17, 2019): @MihaZupan Make sense. Thanks for your explanation and fixing the bug.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#313