You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yeah, I could swear I worked on this exact thing not too long ago (though it's been a crazy summer for me, so it's also just as likely I'm thinking of something totally different).
I'm also wondering if the Markdown parser is getting in the middle and encoding it before I see it (or something related to that process on my end).
I'll take a look - I'm assuming you're on the latest version?
While CommonMark expects & in links to be rendered as & and browsers would handle it, the problem here is that Statiq.Razor converts it to &.
Markdown:
[A link](https://example.com/?foo=bar&baz=123)
Expected HTML output:
<p>
<a href="https://example.com/?foo=bar&baz=123">
A link
</a>
</p>
Actual HTML output:
<p>
<a href="https://example.com/?foo=bar&amp;baz=123">
A link
</a>
</p>
I updated #262 to contain a test case, with an link as generated by Statiq.Markdown, which shows that Statiq.Razor renders the link invalid.
@daveaglick Not sure what's the best way to proceed here: Currently Statiq.Markdown (Markdig) and Statiq.Razor (TagBuilder) are encoding. We need to get rid of one of those. There's no option for either Markdig or TagBuilder to not encode and would need additional code on either side.
IMHO best solution would be to not have it encoded in Statiq.Markdown in cases where Statiq.Razor runs afterwards in the pipeline, but not sure how this can be detected.
Activity
pascalberger commentedon Sep 13, 2022
Might be a duplicate of #170 or part of what was discussed in #170, but not sure if this is supposed to be fixed with 9727372.
daveaglick commentedon Sep 15, 2022
Yeah, I could swear I worked on this exact thing not too long ago (though it's been a crazy summer for me, so it's also just as likely I'm thinking of something totally different).
I'm also wondering if the Markdown parser is getting in the middle and encoding it before I see it (or something related to that process on my end).
I'll take a look - I'm assuming you're on the latest version?
pascalberger commentedon Sep 16, 2022
Thanks! Yes, this is with a site built with Statiq.Web 1.0.0-beta.49
pascalberger commentedon Feb 4, 2023
@daveaglick I can confirm that it is the Markdown parser which is responsible for the behavior. I created a test case in #262
pascalberger commentedon Feb 4, 2023
Related Markdig issue: xoofx/markdig#514
pascalberger commentedon Feb 6, 2023
While CommonMark expects
&in links to be rendered as&and browsers would handle it, the problem here is that Statiq.Razor converts it to&amp;.Markdown:
Expected HTML output:
Actual HTML output:
I updated #262 to contain a test case, with an link as generated by Statiq.Markdown, which shows that Statiq.Razor renders the link invalid.
pascalberger commentedon Feb 6, 2023
Issue is caused by the use of
TagBuilder, which will encode the link a second time:Statiq.Framework/src/extensions/Statiq.Razor/IHtmlHelperExtensions.cs
Line 289 in e990cb1
pascalberger commentedon Feb 7, 2023
@daveaglick Not sure what's the best way to proceed here: Currently Statiq.Markdown (Markdig) and Statiq.Razor (TagBuilder) are encoding. We need to get rid of one of those. There's no option for either Markdig or TagBuilder to not encode and would need additional code on either side.
IMHO best solution would be to not have it encoded in Statiq.Markdown in cases where Statiq.Razor runs afterwards in the pipeline, but not sure how this can be detected.