1
0
mirror of https://gitea.com/jolheiser/sip synced 2024-11-23 04:12:00 +01:00
sip/modules/markdown/markdown.go

18 lines
355 B
Go
Raw Normal View History

package markdown
import (
"github.com/charmbracelet/glamour"
"github.com/kyokomi/emoji"
"strings"
)
func normalizeNewlines(s string) string {
s = strings.ReplaceAll(s, "\r\n", "\n")
s = strings.ReplaceAll(s, "\r", "\n")
return s
}
func Render(text string) (string, error) {
return glamour.Render(emoji.Sprint(normalizeNewlines(text)), "dark")
}