mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
How to not encode query string parameters in link url #438
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @JoshClose on GitHub (Feb 17, 2021).
When a query string is in a URL, it is getting encoded. Is there a way to have it not encoded?
outputs
I would like
@MihaZupan commented on GitHub (Feb 17, 2021):
You should be able to use the
LinkRewriteronHtmlRendererto remove the query part@JoshClose commented on GitHub (Feb 17, 2021):
I don't want the query removed. I just want to keep it intact.
@xoofx commented on GitHub (Feb 17, 2021):
Nope. It requires a change to the code to add an option to HtmlRenderer to avoid the Url encoding. The CommonMark specs don't enforce the encoding, so I would believe that it would be ok to have an option. PR welcome.
@MihaZupan commented on GitHub (Feb 17, 2021):
Ah, sorry. One way would be to use a custom
LinkInlineRendererand not callWriteEscapeUrl.Why would you want to do this though?
@JoshClose commented on GitHub (Feb 17, 2021):
So when someone clicks the link, it goes to the correct address. I feel like I'm missing something or am confused about this.
@xoofx commented on GitHub (Feb 17, 2021):
That's weird because the encoding has been here for years without being an issue... there is something else...
@xoofx commented on GitHub (Feb 17, 2021):
To be fair, I don't recall why markdig escape
&to&in an URL...hm....@xoofx commented on GitHub (Feb 17, 2021):
it could be a bug actually, I really don't get this
&to&, it's HTML escape, not URL....@xoofx commented on GitHub (Feb 17, 2021):
babelmark is showing the same behavior for almost all Markdown implems... ok, now I'm confused! 😅
@xoofx commented on GitHub (Feb 17, 2021):
while the example 591 in the specs seems to escape to
&to&... so yeah, it seems the correct behavior, not sure what to thing about it, will have to think about it with a clearer mind tomorrow!@xoofx commented on GitHub (Feb 17, 2021):
By curiosity, with which browser are you actually testing this link?
@JoshClose commented on GitHub (Feb 17, 2021):
Looks like it works as Chrome/Edge will change the raw url with
&to just&. Maybe this is a non-issue. It seemed like it shouldn't and the online markdown one I tested with showed it didn't, so here I am. :) https://dillinger.io/ Though now seeing that browsers will correct the html in the link, maybe this one is outputting the same as MarkDig.@JoshClose commented on GitHub (Feb 17, 2021):
If CommonMark shows it should be encoded then this is a non-issue. I don't understand why it would encode parts of the actual URL for an href, but I guess that's how it is.
@JoshClose commented on GitHub (Feb 17, 2021):
Thanks for looking into this.
@jjxtra commented on GitHub (Mar 18, 2023):
What would it take to add an optional bool property somewhere to the pipeline to not write escaped urls?