Why is the hyperlink & automatically encoded as & #686

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

Originally created by @colindcli on GitHub (Jul 4, 2024).

var pipeline = new MarkdownPipelineBuilder().Build();
var md = @"[link](https://pan.test.com/s/?pwd=93d3&path=%2Fv%2Ffid)";
var doc = Markdown.Parse(md, pipeline);
var html = doc.ToHtml(pipeline);  //<p><a href="https://pan.test.com/s/?pwd=93d3&amp;path=%2Fv%2Ffid">link</a></p>

Output hyperlinks & automatically encode as &

Originally created by @colindcli on GitHub (Jul 4, 2024). ``` var pipeline = new MarkdownPipelineBuilder().Build(); var md = @"[link](https://pan.test.com/s/?pwd=93d3&path=%2Fv%2Ffid)"; var doc = Markdown.Parse(md, pipeline); var html = doc.ToHtml(pipeline); //<p><a href="https://pan.test.com/s/?pwd=93d3&amp;path=%2Fv%2Ffid">link</a></p> ``` Output hyperlinks & automatically encode as &amp;
claunia added the question label 2026-01-29 14:42:58 +00:00
Author
Owner

@xoofx commented on GitHub (Jul 13, 2024):

I don't remember that it was clearly specified in the specs (left to the implementation), and babelmark indicates that most CommonMark implementation are escaping here

It has been the behavior for more than 6 years now, so I don't think it is a problem.

@xoofx commented on GitHub (Jul 13, 2024): I don't remember that it was clearly specified in the specs (left to the implementation), and babelmark indicates that most CommonMark implementation are escaping [here](https://babelmark.github.io/?text=%5Blink%5D(https%3A%2F%2Fpan.test.com%2Fs%2F%3Fpwd%3D93d3%26path%3D%252Fv%252Ffid)) It has been the behavior for more than 6 years now, so I don't think it is a problem.
Author
Owner

@colindcli commented on GitHub (Jul 13, 2024):

Indeed, this problem is not a big one. It would be better if you can keep the link as it is, or make a configuration. Thank you!

@colindcli commented on GitHub (Jul 13, 2024): Indeed, this problem is not a big one. It would be better if you can keep the link as it is, or make a configuration. Thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#686