@@ -36,25 +36,14 @@ pub(super) fn render(
3636 lines. extend ( render_pinned_todos_message ( msg, width as u16 , diff_mode) ) ;
3737 lines. push ( Line :: default ( ) ) ;
3838
39- // Cards intentionally abbreviate prose. The appendix never does: include
40- // every field plus current and historical weaknesses from the same frozen
41- // snapshot. Keep Markdown's semantic heading/emphasis styles, not the
42- // generic system renderer's uniform color or compact-notice path.
39+ // Cards intentionally abbreviate prose. Keep the full evidence underneath
40+ // in compact semantic rows rather than a second, large Markdown document.
4341 let details = crate :: todo:: completion_report:: render_completion_report (
4442 & snapshot. todos ,
4543 & snapshot. plan ,
4644 & snapshot. goals ,
4745 ) ;
48- let details = preserve_hard_line_breaks_for_markdown ( & details) ;
49- let mut appendix = markdown:: render_markdown_with_width ( & details, Some ( width) ) ;
50- for line in & mut appendix {
51- for span in & mut line. spans {
52- if span. style . fg . is_none ( ) {
53- span. style . fg = Some ( todo_meta_color ( ) ) ;
54- }
55- }
56- }
57- lines. extend ( markdown:: wrap_lines ( appendix, width) ) ;
46+ lines. extend ( render_detail_rows ( & details, width) ) ;
5847 // Preserve the pinned card's spans verbatim. Only pathological terminal
5948 // widths smaller than its indent need an extra wrapping pass.
6049 Some (
@@ -71,10 +60,77 @@ pub(super) fn render(
7160 )
7261}
7362
63+ fn render_detail_rows ( details : & str , width : usize ) -> Vec < Line < ' static > > {
64+ let mut lines = Vec :: new ( ) ;
65+ let mut weaknesses = false ;
66+ for raw in details. lines ( ) . filter ( |line| !line. is_empty ( ) ) {
67+ if raw. starts_with ( "# " ) {
68+ continue ;
69+ }
70+ let ( text, color, bold) = if let Some ( heading) = raw. strip_prefix ( "## " ) {
71+ weaknesses = heading. starts_with ( "Current weaknesses" )
72+ || heading. starts_with ( "Earlier weak states" ) ;
73+ lines. push ( Line :: default ( ) ) ;
74+ ( heading, todo_group_color ( ) , true )
75+ } else if let Some ( heading) = raw. strip_prefix ( "### " ) {
76+ ( heading, todo_group_color ( ) , true )
77+ } else if let Some ( item) = raw. strip_prefix ( "- " ) {
78+ (
79+ item,
80+ if weaknesses {
81+ todo_warning_color ( )
82+ } else {
83+ todo_meta_color ( )
84+ } ,
85+ false ,
86+ )
87+ } else {
88+ ( raw, todo_meta_color ( ) , false )
89+ } ;
90+ // Decode the formatter's escaped data through the existing Markdown
91+ // parser. It cannot become active markup because punctuation is escaped.
92+ let rendered = markdown:: render_markdown_with_width ( text, Some ( width) ) ;
93+ for mut line in rendered {
94+ line. spans . insert ( 0 , Span :: raw ( " " ) ) ;
95+ for span in & mut line. spans {
96+ span. style . fg = Some ( color) ;
97+ if bold {
98+ span. style = span. style . bold ( ) ;
99+ }
100+ }
101+ lines. extend ( markdown:: wrap_lines ( vec ! [ line] , width) ) ;
102+ }
103+ }
104+ lines
105+ }
106+
74107#[ cfg( test) ]
75108mod tests {
76109 use super :: * ;
77110
111+ #[ test]
112+ fn todo_completion_details_use_compact_warning_rows ( ) {
113+ let lines = render_detail_rows (
114+ "# Todo completion report\n \n ## Current weaknesses\n \n - acceptance path blocked\n \n ## Plan\n \n - **User intention:** Preserve all evidence\n - **Intent:** clear\n " ,
115+ 80 ,
116+ ) ;
117+ assert_eq ! ( lines. len( ) , 7 ) ;
118+ let warning = lines
119+ . iter ( )
120+ . find ( |line| line. to_string ( ) . contains ( "acceptance path blocked" ) )
121+ . unwrap ( ) ;
122+ assert ! (
123+ warning
124+ . spans
125+ . iter( )
126+ . all( |span| span. style. fg == Some ( todo_warning_color( ) ) )
127+ ) ;
128+ assert ! ( lines. iter( ) . any( |line| {
129+ line. to_string( )
130+ . contains( "User intention: Preserve all evidence" )
131+ } ) ) ;
132+ }
133+
78134 #[ test]
79135 fn todo_completion_reuses_styled_pinned_cards_at_all_widths ( ) {
80136 let mut msg = DisplayMessage :: system (
0 commit comments