1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-06-27 16:36:00 +00:00

Add parse_markdown rewrite function

This commit is contained in:
Gabe Cook 2022-07-27 09:55:28 -05:00 committed by Frédéric Guillot
parent 9ba15e9649
commit 36df7b36ec
4 changed files with 21 additions and 0 deletions

View file

@ -15,6 +15,8 @@ import (
"miniflux.app/config"
"github.com/PuerkitoBio/goquery"
"github.com/yuin/goldmark"
goldmarkhtml "github.com/yuin/goldmark/renderer/html"
)
var (
@ -318,3 +320,18 @@ func decodeBase64Content(entryContent string) string {
return html.EscapeString(string(ret))
}
}
func parseMarkdown(entryContent string) string {
var sb strings.Builder
md := goldmark.New(
goldmark.WithRendererOptions(
goldmarkhtml.WithUnsafe(),
),
)
if err := md.Convert([]byte(entryContent), &sb); err != nil {
return entryContent
}
return sb.String()
}