1
0
mirror of https://gitea.com/jolheiser/sip synced 2024-11-23 04:12:00 +01:00
sip/modules/markdown/markdown.go
John Olheiser 448e12ce38 Imp formatting (#17)
Ran imp

Signed-off-by: jolheiser <john.olheiser@gmail.com>

Co-authored-by: jolheiser <john.olheiser@gmail.com>
Reviewed-on: https://gitea.com/jolheiser/sip/pulls/17
2020-05-07 01:09:31 +00:00

19 lines
356 B
Go

package markdown
import (
"strings"
"github.com/charmbracelet/glamour"
"github.com/kyokomi/emoji"
)
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")
}