Skip to content

Commit 409226e

Browse files
authored
Merge branch 'master' into lunny/delete_oauth2
2 parents 8f1d884 + c680eb2 commit 409226e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

modules/markup/markdown/goldmark.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ func (g *ASTTransformer) Transform(node *ast.Document, reader text.Reader, pc pa
9898
}
9999
prefix = strings.Replace(prefix, "/src/", "/media/", 1)
100100

101-
lnk := string(link)
101+
lnk := strings.TrimLeft(string(link), "/")
102+
102103
lnk = giteautil.URLJoin(prefix, lnk)
103104
link = []byte(lnk)
104105
}

modules/markup/markdown/markdown_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,19 @@ func TestRender_Images(t *testing.T) {
9393
test(
9494
"[!["+title+"]("+url+")]("+href+")",
9595
`<p><a href="`+href+`" rel="nofollow"><img src="`+result+`" alt="`+title+`"/></a></p>`)
96+
97+
url = "/../../.images/src/02/train.jpg"
98+
test(
99+
"!["+title+"]("+url+")",
100+
`<p><a href="`+result+`" rel="nofollow"><img src="`+result+`" alt="`+title+`"/></a></p>`)
101+
102+
test(
103+
"[["+title+"|"+url+"]]",
104+
`<p><a href="`+result+`" rel="nofollow"><img src="`+result+`" title="`+title+`" alt="`+title+`"/></a></p>`)
105+
test(
106+
"[!["+title+"]("+url+")]("+href+")",
107+
`<p><a href="`+href+`" rel="nofollow"><img src="`+result+`" alt="`+title+`"/></a></p>`)
108+
96109
}
97110

98111
func testAnswers(baseURLContent, baseURLImages string) []string {

0 commit comments

Comments
 (0)