First implementation of web based editor to HTML pipeline

This commit is contained in:
2024-02-18 10:07:49 +01:00
parent ff657fd508
commit ad9bfb2439
9 changed files with 89 additions and 2 deletions

18
cmd/articles/markdown.go Normal file
View File

@ -0,0 +1,18 @@
package articles
import (
"bytes"
"fmt"
"github.com/yuin/goldmark"
)
func ConvertToHTML(markdown string) (string, error) {
var buf bytes.Buffer
if err := goldmark.Convert([]byte(markdown), &buf); err != nil {
return "", fmt.Errorf("error: cmd/articles/markdown.go ConvertToHTML goldmark.Convert(): %v", err)
}
return buf.String(), nil
}