AutoLinks: URL that contain underscore at end are not parsed correctly #678

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

Originally created by @hey-red on GitHub (May 10, 2024).

Markdig 0.37.0

Example link: https://github.com/xoofx/markdig_
Result: <p><a href="https://github.com/xoofx/markdig">https://github.com/xoofx/markdig</a>_</p>

var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
var result = Markdown.ToHtml("https://github.com/xoofx/markdig_", pipeline);

Console.WriteLine(result); //-> <p><a href="https://github.com/xoofx/markdig">https://github.com/xoofx/markdig</a>_</p>

Github has same behaviour, so it's not a bug I guess?
https://github.com/xoofx/markdig_

Originally created by @hey-red on GitHub (May 10, 2024). Markdig 0.37.0 Example link: `https://github.com/xoofx/markdig_` Result: `<p><a href="https://github.com/xoofx/markdig">https://github.com/xoofx/markdig</a>_</p>` ```C# var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build(); var result = Markdown.ToHtml("https://github.com/xoofx/markdig_", pipeline); Console.WriteLine(result); //-> <p><a href="https://github.com/xoofx/markdig">https://github.com/xoofx/markdig</a>_</p> ``` Github has same behaviour, so it's not a bug I guess? https://github.com/xoofx/markdig_
Author
Owner

@MihaZupan commented on GitHub (May 12, 2024):

This is intentional - some trailing punctuation characters are trimmed from autolinks.
See https://github.github.com/gfm/#extended-autolink-path-validation

I'd suggest enclosing potentially problematic links in brackets manually <https://github.com/xoofx/markdig_>

@MihaZupan commented on GitHub (May 12, 2024): This is intentional - some trailing punctuation characters are trimmed from autolinks. See https://github.github.com/gfm/#extended-autolink-path-validation I'd suggest enclosing potentially problematic links in brackets manually `<https://github.com/xoofx/markdig_>`
Author
Owner

@hey-red commented on GitHub (May 12, 2024):

Okay. Thanks for response.

@hey-red commented on GitHub (May 12, 2024): Okay. Thanks for response.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#678