From 1ddb4d76a750748012c91204740d49991ad2f968 Mon Sep 17 00:00:00 2001 From: Shubhankar Kanchan Gupta Date: Fri, 10 Jul 2020 19:31:15 +0530 Subject: [PATCH] Strip carriage returns in markdown rendering (#1351) --- utils/utils.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/utils.go b/utils/utils.go index c84860d9e..885e5ea10 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -26,6 +26,9 @@ func RenderMarkdown(text string) (string, error) { if isColorEnabled() { style = "dark" } + // Glamour rendering preserves carriage return characters in code blocks, but + // we need to ensure that no such characters are present in the output. + text = strings.ReplaceAll(text, "\r\n", "\n") return glamour.Render(text, style) }