diff options
author | zeripath <art27@cantab.net> | 2021-03-14 16:36:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-14 16:36:51 +0000 |
commit | 164e35ead3c1b9b82d4a23644f6fe96652a747eb (patch) | |
tree | 259818dbb68a5361b7f329b163ded6c124795112 /modules/markup/markdown/markdown_test.go | |
parent | 6463483ec5d441879037d43b0de24f5e92f927d0 (diff) | |
download | gitea-164e35ead3c1b9b82d4a23644f6fe96652a747eb.tar.gz gitea-164e35ead3c1b9b82d4a23644f6fe96652a747eb.zip |
Make sure sibling images get a link too (#14979)
* Make sure sibling images get a link too
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.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/markup/markdown/markdown_test.go b/modules/markup/markdown/markdown_test.go index 89005fc25d..3196beea1f 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 := ` + +` + 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) +} |