Skip to content

Commit

Permalink
Return markdown as html so it doesn't have to be explicitly trusted w…
Browse files Browse the repository at this point in the history
…ith trustHtml func
  • Loading branch information
infogulch committed Mar 7, 2024
1 parent efa5ca2 commit 63f691d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func funcSanitizeHtml(policyName string, html string) (template.HTML, error) {

// funcMarkdown renders the markdown body as HTML. The resulting
// HTML is NOT escaped so that it can be rendered as HTML.
func funcMarkdown(input string) (string, error) {
func funcMarkdown(input string) (template.HTML, error) {
md := goldmark.New(
goldmark.WithExtensions(
extension.GFM,
Expand Down Expand Up @@ -85,7 +85,7 @@ func funcMarkdown(input string) (string, error) {
return "", err
}

return buf.String(), nil
return template.HTML(buf.String()), nil
}

// splitFrontMatter parses front matter out from the beginning of input,
Expand Down

0 comments on commit 63f691d

Please sign in to comment.