From 9ae92459a53f9cccd34460f859c1370715c36a1d Mon Sep 17 00:00:00 2001 From: Unknwon Date: Tue, 14 Oct 2014 23:44:34 -0400 Subject: Fix repo css and rel path img in md --- modules/base/markdown.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'modules/base') 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-]*)?`) -- cgit v1.2.3