summaryrefslogtreecommitdiffstats
path: root/modules/markup/markdown/markdown_test.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-03-15 04:34:56 +0000
committerGitHub <noreply@github.com>2021-03-15 12:34:56 +0800
commitc965ed6529872518595098824b42e4471b59c82a (patch)
tree4c6761ad2308fc7203ead381749b7a6113ff81d3 /modules/markup/markdown/markdown_test.go
parent71a2adbf10f0f3df9d9f2ab59c51bbcb19c00c4b (diff)
downloadgitea-c965ed6529872518595098824b42e4471b59c82a.tar.gz
gitea-c965ed6529872518595098824b42e4471b59c82a.zip
Make sure sibling images get a link too (#14979) (#14995)
Backport #14979 Due a problem with the ast.Walker in the our transformer in goldmark an image with a sibling image will not be transformed to gain a parent link. This PR fixes this. Fix #12925 Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/markup/markdown/markdown_test.go')
-rw-r--r--modules/markup/markdown/markdown_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/markup/markdown/markdown_test.go b/modules/markup/markdown/markdown_test.go
index 7f27a43a7d..176bf4baad 100644
--- a/modules/markup/markdown/markdown_test.go
+++ b/modules/markup/markdown/markdown_test.go
@@ -308,3 +308,14 @@ func TestRender_RenderParagraphs(t *testing.T) {
test(t, "A\n\nB\nC\n", 2)
test(t, "A\n\n\nB\nC\n", 2)
}
+
+func TestRenderSiblingImages_Issue12925(t *testing.T) {
+ testcase := `![image1](/image1)
+![image2](/image2)
+`
+ expected := `<p><a href="/image1" rel="nofollow"><img src="/image1" alt="image1"></a><br>
+<a href="/image2" rel="nofollow"><img src="/image2" alt="image2"></a></p>
+`
+ res := string(RenderRaw([]byte(testcase), "", false))
+ assert.Equal(t, expected, res)
+}