Skip to content

Commit

Permalink
fix: escape curly brackets when rendering markdown field doc (#81)
Browse files Browse the repository at this point in the history
Signed-off-by: Rémi BUISSON <remi-buisson@orange.fr>
  • Loading branch information
darkweaver87 committed Jul 22, 2024
1 parent ea9fcaa commit 1c93a29
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions renderer/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ func (m *MarkdownRenderer) RenderFieldDoc(text string) string {
// so that including | in a comment does not result in wonky tables.
out := strings.ReplaceAll(text, "|", "\\|")

// Escape the curly bracket character.
out = strings.ReplaceAll(out, "{", "\\{")
out = strings.ReplaceAll(out, "}", "\\}")

// Replace newlines with 1 line break so that they don't break the Markdown table formatting.
out = strings.ReplaceAll(out, "\n", "<br />")
// and remove double newline generated for empty lines
Expand Down

0 comments on commit 1c93a29

Please sign in to comment.