Strip carriage returns in markdown rendering (#1351)

This commit is contained in:
Shubhankar Kanchan Gupta 2020-07-10 19:31:15 +05:30 committed by GitHub
parent 659a474a13
commit 1ddb4d76a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
}