From 2355023de02110c0de12bd21cc0a0b61aa03508c Mon Sep 17 00:00:00 2001 From: Ryan Hendrickson Date: Tue, 22 Jul 2025 02:16:35 -0400 Subject: [PATCH] Fix hyperlink rendering in package description The previous code rendered the contents of the hyperlink to a string of HTML before embedding it into the anchor element, which caused inner HTML elements to appear escaped in the final document. Embedding the contents directly without rendering them results in no escaping. --- src/Distribution/Server/Pages/Package/HaddockHtml.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Distribution/Server/Pages/Package/HaddockHtml.hs b/src/Distribution/Server/Pages/Package/HaddockHtml.hs index 8b5b3f0d5..542d7cc63 100644 --- a/src/Distribution/Server/Pages/Package/HaddockHtml.hs +++ b/src/Distribution/Server/Pages/Package/HaddockHtml.hs @@ -27,7 +27,7 @@ htmlMarkup modResolv = Markup { markupOrderedList = ordList . map snd, markupDefList = defList, markupCodeBlock = pre, - markupHyperlink = \(Hyperlink url mLabel) -> anchor ! [href url] << maybe url showHtmlFragment mLabel, + markupHyperlink = \(Hyperlink url mLabel) -> anchor ! [href url] << fromMaybe (toHtml url) mLabel, markupAName = \aname -> namedAnchor aname << toHtml "", markupPic = \(Picture uri mtitle) -> image ! (src uri : maybe [] (return . title) mtitle), markupMathInline = \mathjax -> toHtml ("\\(" ++ mathjax ++ "\\)"),