fix(markup): resolve and proxy srcset links of <source> elements (#39708)

1. use correct links for srcset attribute of picture source
2. wrap the picture element with a link correctly

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Basavaraj S mandwxiaoguang authored and GitHub committed 2026-10-13 01:33:19 +00:00
1 parent bd28f254fa
commit a1cc651267
9 files changed
+247 -14

No files matched your search

+4 -1
View File
@@ -355,6 +355,8 @@ func visitNode(ctx *RenderContext, procs []processor, node *html.Node) *html.Nod
return visitNodeImg(ctx, node)
} else if node.Data == "video" {
return visitNodeVideo(ctx, node)
} else if node.Data == "source" {
return visitNodePictureSource(ctx, node)
}
if node.Data == "a" {
@@ -363,10 +365,11 @@ func visitNode(ctx *RenderContext, procs []processor, node *html.Node) *html.Nod
// because the content there is not processable, for example: the content is a commit id or a full URL.
procs = emojiProcessors
}
next := node.NextSibling
for n := node.FirstChild; n != nil; {
n = visitNode(ctx, procs, n)
}
return node.NextSibling
return next
}
// createKeyword() renders a highlighted version of an action keyword