@@ -14,6 +14,7 @@ import (
1414 "charm.land/lipgloss/v2"
1515
1616 "github.com/docker/docker-agent/pkg/tools"
17+ "github.com/docker/docker-agent/pkg/tui/components/markdown"
1718 "github.com/docker/docker-agent/pkg/tui/core/layout"
1819 "github.com/docker/docker-agent/pkg/tui/styles"
1920)
@@ -378,7 +379,7 @@ func (d *ElicitationDialog) View() string {
378379 content := NewContent (contentWidth )
379380 content .AddTitle (d .title )
380381 content .AddSeparator ()
381- content .AddContent (styles . DialogContentStyle . Width ( contentWidth ). Render ( d .message ))
382+ content .AddContent (renderMarkdownMessage ( d .message , contentWidth ))
382383
383384 if len (d .fields ) > 0 {
384385 content .AddSeparator ()
@@ -509,7 +510,7 @@ func (d *ElicitationDialog) handleMouseClick(msg tea.MouseClickMsg) (layout.Mode
509510 header := lipgloss .JoinVertical (lipgloss .Left ,
510511 styles .DialogTitleStyle .Width (contentWidth ).Render (d .title ),
511512 RenderSeparator (contentWidth ),
512- styles . DialogContentStyle . Width ( contentWidth ). Render ( d .message ),
513+ renderMarkdownMessage ( d .message , contentWidth ),
513514 RenderSeparator (contentWidth ),
514515 )
515516 y := ContentStartRow (dialogRow , header )
@@ -612,3 +613,13 @@ func (d *ElicitationDialog) createInput(field ElicitationField, idx int) textinp
612613
613614 return ti
614615}
616+
617+ // renderMarkdownMessage renders a message string as markdown for display in dialogs.
618+ // Falls back to plain text rendering if the markdown renderer fails.
619+ func renderMarkdownMessage (message string , contentWidth int ) string {
620+ rendered , err := markdown .NewRenderer (contentWidth ).Render (message )
621+ if err != nil {
622+ return styles .DialogContentStyle .Width (contentWidth ).Render (message )
623+ }
624+ return strings .TrimRight (rendered , "\n " )
625+ }
0 commit comments