api/misc/markdown: remove Mode option (#5910)

We already have a separate `/markdown/raw` API, remove redundant functionality here.
pull/5911/head
ᴜɴᴋɴᴡᴏɴ 2020-01-29 02:41:31 +08:00 committed by GitHub
parent 5e6c3b9d0e
commit 2f4cc5480e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 9 deletions

2
go.mod
View File

@ -19,7 +19,7 @@ require (
github.com/gogs/chardet v0.0.0-20150115103509-2404f7772561
github.com/gogs/cron v0.0.0-20171120032916-9f6c956d3e14
github.com/gogs/git-module v0.8.3
github.com/gogs/go-gogs-client v0.0.0-20190710002546-4c3c18947c15
github.com/gogs/go-gogs-client v0.0.0-20200128182646-c69cb7680fd4
github.com/gogs/go-libravatar v0.0.0-20191106065024-33a75213d0a0
github.com/gogs/minwinsvc v0.0.0-20170301035411-95be6356811a
github.com/google/go-github v17.0.0+incompatible

2
go.sum
View File

@ -82,6 +82,8 @@ github.com/gogs/git-module v0.8.3 h1:9f8oxSs9OACWrGBYMVnnQNzyTcVN+zzcBM7CXnbmezw
github.com/gogs/git-module v0.8.3/go.mod h1:aj4tcm7DxaszJWpZLZIRL6gfPXyguAHiE1PDfAAPrCw=
github.com/gogs/go-gogs-client v0.0.0-20190710002546-4c3c18947c15 h1:tgEyCCe4+o8A2K/PEi9lF0QMA6XK+Y/j/WN01LnNbbo=
github.com/gogs/go-gogs-client v0.0.0-20190710002546-4c3c18947c15/go.mod h1:fR6z1Ie6rtF7kl/vBYMfgD5/G5B1blui7z426/sj2DU=
github.com/gogs/go-gogs-client v0.0.0-20200128182646-c69cb7680fd4 h1:C7NryI/RQhsIWwC2bHN601P1wJKeuQ6U/UCOYTn3Cic=
github.com/gogs/go-gogs-client v0.0.0-20200128182646-c69cb7680fd4/go.mod h1:fR6z1Ie6rtF7kl/vBYMfgD5/G5B1blui7z426/sj2DU=
github.com/gogs/go-libravatar v0.0.0-20191106065024-33a75213d0a0 h1:K02vod+sn3M1OOkdqi2tPxN2+xESK4qyITVQ3JkGEv4=
github.com/gogs/go-libravatar v0.0.0-20191106065024-33a75213d0a0/go.mod h1:Zas3BtO88pk1cwUfEYlvnl/CRwh0ybDxRWSwRjG8I3w=
github.com/gogs/minwinsvc v0.0.0-20170301035411-95be6356811a h1:8DZwxETOVWIinYxDK+i6L+rMb7eGATGaakD6ZucfHVk=

View File

@ -24,14 +24,7 @@ func Markdown(c *context.APIContext, form api.MarkdownOption) {
return
}
var md []byte
switch form.Mode {
case "gfm":
md = markup.Markdown([]byte(form.Text), form.Context, nil)
default:
md = markup.SanitizeBytes(markup.RawMarkdown([]byte(form.Text), ""))
}
_, _ = c.Write(md)
_, _ = c.Write(markup.Markdown([]byte(form.Text), form.Context, nil))
}
func MarkdownRaw(c *context.APIContext) {