Added ability to login

This commit is contained in:
2024-02-24 09:54:25 +01:00
parent 068bf045a7
commit 2e08600814
7 changed files with 102 additions and 46 deletions

22
cmd/data/markdown.go Normal file
View File

@@ -0,0 +1,22 @@
package data
import (
"bytes"
"fmt"
"github.com/microcosm-cc/bluemonday"
"github.com/yuin/goldmark"
)
func ConvertToHTML(md string) (string, error) {
var buf bytes.Buffer
if err := goldmark.Convert([]byte(md), &buf); err != nil {
return "", fmt.Errorf("error converting markdown to html: %v", err)
}
p := bluemonday.UGCPolicy()
html := p.Sanitize(buf.String())
return html, nil
}