mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-16 15:02:43 +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:
parent
12e71e5706
commit
0602a44b27
6 changed files with 273 additions and 152 deletions
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue