Files
Gogs/internal/route/api/v1/misc/markdown.go
ᴊᴏᴇ ᴄʜᴇɴ 59e9fa191b chore: remove all MIT license file headers (#8083)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
2026-01-08 19:32:15 -05:00

27 lines
536 B
Go

package misc
import (
api "github.com/gogs/go-gogs-client"
"gogs.io/gogs/internal/context"
"gogs.io/gogs/internal/markup"
)
func Markdown(c *context.APIContext, form api.MarkdownOption) {
if form.Text == "" {
_, _ = c.Write([]byte(""))
return
}
_, _ = c.Write(markup.Markdown([]byte(form.Text), form.Context, nil))
}
func MarkdownRaw(c *context.APIContext) {
body, err := c.Req.Body().Bytes()
if err != nil {
c.Error(err, "read body")
return
}
_, _ = c.Write(markup.SanitizeBytes(markup.RawMarkdown(body, "")))
}