mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 10:18:38 +00:00
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>
This commit is contained in:
committed by
Lunny Xiao
parent
12e71e5706
commit
0602a44b27
@@ -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))
|
||||
}
|
||||
|
Reference in New Issue
Block a user