John Olheiser
894a641ef8
All checks were successful
continuous-integration/drone/push Build is passing
Clean up docs Signed-off-by: jolheiser <john.olheiser@gmail.com> Add generated docs Signed-off-by: jolheiser <john.olheiser@gmail.com> Update go.sum Signed-off-by: jolheiser <john.olheiser@gmail.com> Fix remote parsing Signed-off-by: jolheiser <john.olheiser@gmail.com> Refactor and clean up Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: jolheiser <john.olheiser@gmail.com> Reviewed-on: #29
19 lines
356 B
Go
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")
|
|
}
|