summaryrefslogtreecommitdiffstats
path: root/modules/base
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-10-14 23:44:34 -0400
committerUnknwon <joe2010xtmf@163.com>2014-10-14 23:44:34 -0400
commit9ae92459a53f9cccd34460f859c1370715c36a1d (patch)
tree9efd54a3709fb4c86abf61489cbd1ae9a58055af /modules/base
parent5b3f1efd9f335a57d2ea722df672a7490e0398cb (diff)
downloadgitea-9ae92459a53f9cccd34460f859c1370715c36a1d.tar.gz
gitea-9ae92459a53f9cccd34460f859c1370715c36a1d.zip
Fix repo css and rel path img in md
Diffstat (limited to 'modules/base')
-rw-r--r--modules/base/markdown.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/base/markdown.go b/modules/base/markdown.go
index cb08320099..7b371dbd9c 100644
--- a/modules/base/markdown.go
+++ b/modules/base/markdown.go
@@ -91,6 +91,14 @@ func (options *CustomRender) Link(out *bytes.Buffer, link []byte, title []byte,
options.Renderer.Link(out, link, title, content)
}
+func (options *CustomRender) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {
+ if len(link) > 0 && !isLink(link) {
+ link = []byte(path.Join(strings.Replace(options.urlPrefix, "/src/", "/raw/", 1), string(link)))
+ }
+
+ options.Renderer.Image(out, link, title, alt)
+}
+
var (
MentionPattern = regexp.MustCompile(`@[0-9a-zA-Z_]{1,}`)
commitPattern = regexp.MustCompile(`(\s|^)https?.*commit/[0-9a-zA-Z]+(#+[0-9a-zA-Z-]*)?`)