1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-05-11 05:55:29 +00:00

#1433 images with links in Markdown

- #1904 minor fix on image link
This commit is contained in:
Unknwon
2015-11-06 11:10:27 -05:00
parent 2bd64621fc
commit 54ca0b2f09
4 changed files with 13 additions and 4 deletions

View File

@ -100,11 +100,20 @@ func (options *CustomRender) Link(out *bytes.Buffer, link []byte, title []byte,
}
func (options *CustomRender) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {
prefix := strings.Replace(options.urlPrefix, "/src/", "/raw/", 1)
if len(link) > 0 && !isLink(link) {
link = []byte(path.Join(strings.Replace(options.urlPrefix, "/src/", "/raw/", 1), string(link)))
if link[0] != '/' {
prefix += "/"
}
link = []byte(prefix + string(link))
}
fmt.Println(2, string(link))
out.WriteString(`<a href="`)
out.Write(link)
out.WriteString(`">`)
options.Renderer.Image(out, link, title, alt)
out.WriteString("</a>")
}
var (