Skip to content

Commit

Permalink
Merge pull request #109 from barrettj12/doc-table
Browse files Browse the repository at this point in the history
#109

- If a flag's description/usage spans multiple lines, the Markdown will not display properly when this is placed inside a table (e.g. [here](https://discourse.charmhub.io/t/command-bootstrap/10132)). Fix this by replacing newlines with spaces to put this on a single line.
  • Loading branch information
jujubot authored Nov 7, 2023
2 parents c27426a + 9dd2c35 commit 76ddcb9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion documentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,9 @@ func (d *documentationCommand) formatFlags(c Command, info *Info) string {
theFlags += fmt.Sprintf("`--%s`", f.Name)
}
formatted += fmt.Sprintf("| %s | %s | %s |\n", theFlags,
EscapeMarkdown(fs[0].DefValue), EscapeMarkdown(fs[0].Usage))
EscapeMarkdown(fs[0].DefValue),
strings.ReplaceAll(EscapeMarkdown(fs[0].Usage), "\n", " "),
)
}
return formatted
}
Expand Down

0 comments on commit 76ddcb9

Please sign in to comment.