Preserve newlines in GitHub-flavored markdown

This commit is contained in:
Mislav Marohnić 2022-01-13 19:41:01 +01:00
parent 456d55ead9
commit 4e1bca736f
3 changed files with 16 additions and 34 deletions

View file

@ -52,7 +52,7 @@ func Render(text string, opts ...glamour.TermRendererOption) (string, error) {
// we need to ensure that no such characters are present in the output.
text = strings.ReplaceAll(text, "\r\n", "\n")
opts = append(opts, glamour.WithEmoji())
opts = append(opts, glamour.WithEmoji(), glamour.WithPreservedNewLines())
tr, err := glamour.NewTermRenderer(opts...)
if err != nil {
return "", err