Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: escape curly brakets for markdown #81

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, "}", "\\}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do the same thing in RenderDefault but I think it's okay to duplicate. We will see in the future if we share some of the chars to be escaped between the two functions.


// 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
Loading