Allow attributes and html in markdown
This commit is contained in:
parent
98af3c6b4e
commit
973abc8a81
@ -7,6 +7,8 @@ import (
|
|||||||
"github.com/microcosm-cc/bluemonday"
|
"github.com/microcosm-cc/bluemonday"
|
||||||
"github.com/yuin/goldmark"
|
"github.com/yuin/goldmark"
|
||||||
"github.com/yuin/goldmark/extension"
|
"github.com/yuin/goldmark/extension"
|
||||||
|
"github.com/yuin/goldmark/parser"
|
||||||
|
"github.com/yuin/goldmark/renderer/html"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ConvertToHTML(md string) (string, error) {
|
func ConvertToHTML(md string) (string, error) {
|
||||||
@ -16,6 +18,12 @@ func ConvertToHTML(md string) (string, error) {
|
|||||||
goldmark.WithExtensions(
|
goldmark.WithExtensions(
|
||||||
extension.GFM,
|
extension.GFM,
|
||||||
),
|
),
|
||||||
|
goldmark.WithParserOptions(
|
||||||
|
parser.WithAttribute(),
|
||||||
|
),
|
||||||
|
goldmark.WithRendererOptions(
|
||||||
|
html.WithUnsafe(), // HTML-Inhalte erlauben
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
if err := gm.Convert([]byte(md), &buf); err != nil {
|
if err := gm.Convert([]byte(md), &buf); err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user