summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/misc/markdown.go
diff options
context:
space:
mode:
authorAndrew Boyarshin <andrew.boyarshin@gmail.com>2017-02-24 21:59:56 +0700
committerLunny Xiao <xiaolunwen@gmail.com>2017-02-24 22:59:56 +0800
commit0602a44b276b009c1f7eb65c589ec284ef4131cf (patch)
tree8177d22a525e6bd7dcc535b58f1813c19ec9efac /routers/api/v1/misc/markdown.go
parent12e71e570619aa6f0e0289caa0b000158260065b (diff)
downloadgitea-0602a44b276b009c1f7eb65c589ec284ef4131cf.tar.gz
gitea-0602a44b276b009c1f7eb65c589ec284ef4131cf.zip
Fix URL handling in the whole markdown module, improve test coverage (#1027)
Amended with string to bool change in API SDK. Signed-off-by: Andrew Boyarshin <andrew.boyarshin@gmail.com>
Diffstat (limited to 'routers/api/v1/misc/markdown.go')
-rw-r--r--routers/api/v1/misc/markdown.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/routers/api/v1/misc/markdown.go b/routers/api/v1/misc/markdown.go
index 947924dbed..188594e83e 100644
--- a/routers/api/v1/misc/markdown.go
+++ b/routers/api/v1/misc/markdown.go
@@ -27,7 +27,13 @@ func Markdown(ctx *context.APIContext, form api.MarkdownOption) {
switch form.Mode {
case "gfm":
- ctx.Write(markdown.Render([]byte(form.Text), markdown.URLJoin(setting.AppURL, form.Context), nil))
+ md := []byte(form.Text)
+ context := markdown.URLJoin(setting.AppURL, form.Context)
+ if form.Wiki {
+ ctx.Write([]byte(markdown.RenderWiki(md, context, nil)))
+ } else {
+ ctx.Write(markdown.Render(md, context, nil))
+ }
default:
ctx.Write(markdown.RenderRaw([]byte(form.Text), "", false))
}