Allow attributes and html in markdown

This commit is contained in:
Jason Streifling 2025-03-01 09:37:56 +01:00
parent 98af3c6b4e
commit 973abc8a81

View File

@ -7,6 +7,8 @@ import (
"github.com/microcosm-cc/bluemonday"
"github.com/yuin/goldmark"
"github.com/yuin/goldmark/extension"
"github.com/yuin/goldmark/parser"
"github.com/yuin/goldmark/renderer/html"
)
func ConvertToHTML(md string) (string, error) {
@ -16,6 +18,12 @@ func ConvertToHTML(md string) (string, error) {
goldmark.WithExtensions(
extension.GFM,
),
goldmark.WithParserOptions(
parser.WithAttribute(),
),
goldmark.WithRendererOptions(
html.WithUnsafe(), // HTML-Inhalte erlauben
),
)
if err := gm.Convert([]byte(md), &buf); err != nil {