feat(ui): add Markdown rendering to comment text (#1019)
Apply ui.RenderMarkdown() to comment text in both bd show and bd comments commands. This enables syntax highlighting, code blocks, and other Markdown formatting in comments.
This commit is contained in:
committed by
GitHub
parent
68da7c9f78
commit
04f0670582
@@ -286,8 +286,9 @@ var showCmd = &cobra.Command{
|
||||
fmt.Printf("\n%s\n", ui.RenderBold("COMMENTS"))
|
||||
for _, comment := range details.Comments {
|
||||
fmt.Printf(" %s %s\n", ui.RenderMuted(comment.CreatedAt.Format("2006-01-02")), comment.Author)
|
||||
commentLines := strings.Split(comment.Text, "\n")
|
||||
for _, line := range commentLines {
|
||||
rendered := ui.RenderMarkdown(comment.Text)
|
||||
// TrimRight removes trailing newlines that Glamour adds, preventing extra blank lines
|
||||
for _, line := range strings.Split(strings.TrimRight(rendered, "\n"), "\n") {
|
||||
fmt.Printf(" %s\n", line)
|
||||
}
|
||||
}
|
||||
@@ -491,8 +492,9 @@ var showCmd = &cobra.Command{
|
||||
fmt.Printf("\n%s\n", ui.RenderBold("COMMENTS"))
|
||||
for _, comment := range comments {
|
||||
fmt.Printf(" %s %s\n", ui.RenderMuted(comment.CreatedAt.Format("2006-01-02")), comment.Author)
|
||||
commentLines := strings.Split(comment.Text, "\n")
|
||||
for _, line := range commentLines {
|
||||
rendered := ui.RenderMarkdown(comment.Text)
|
||||
// TrimRight removes trailing newlines that Glamour adds, preventing extra blank lines
|
||||
for _, line := range strings.Split(strings.TrimRight(rendered, "\n"), "\n") {
|
||||
fmt.Printf(" %s\n", line)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user