Skip to content

Fix health report rendering: tables, scrolling, emoji, wrapping - #21

Merged
jaredpar merged 1 commit into
mainfrom
jaredpar-health-report-rendering-fixes
Jun 24, 2026
Merged

Fix health report rendering: tables, scrolling, emoji, wrapping#21
jaredpar merged 1 commit into
mainfrom
jaredpar-health-report-rendering-fixes

Conversation

@jaredpar

Copy link
Copy Markdown
Owner

Health reports were rendering with several issues that made them hard to read in the terminal. This PR fixes all of them and adds a raw markdown toggle for debugging future rendering problems.

Problems fixed

  • Raw markdown tables -- Tables rendered as pipe-delimited markdown text instead of formatted columns. Now rendered with aligned columns, dim separators, and proper word-wrapping within cells so no content is lost.
  • No scrolling -- Health state and run detail pages used a single ReadKey without a scroll loop. Now supports Up/Down/PgUp/PgDn navigation.
  • Garbled emoji -- Characters like the colored circles were mangled because console output encoding wasn't set. Added Console.OutputEncoding = Encoding.UTF8.
  • Broken table layout from wrapping -- Tables wider than the terminal had their structure destroyed by the panel's line-wrapping logic. Now tables are width-constrained at render time: short columns (<=12 chars) keep their natural width, only wide columns shrink proportionally.
  • "Malformed markup tag" crash -- WrapMarkupLine decoded escaped brackets ([[ to [) for width measurement but failed to re-escape them when rebuilding wrapped output. Spectre then treated literal [#83775] as a (malformed) tag. Fixed with EscapeBrackets() helper.

New feature

  • [M]arkdown toggle -- Press M on health state or run detail pages to switch between rendered and raw markdown views. Useful for debugging rendering issues without leaving the dashboard.

Key design decisions

  • Word-wrapping in table cells (not truncation) so all content remains visible
  • Column width algorithm preserves short columns at natural width -- only columns wider than 12 chars get shrunk
  • maxWidth parameter threaded from ContentWidth into ToMarkupLines and RenderTableAsText so tables are constrained before panel rendering, avoiding the wrapping layer that can't understand table structure

Testing

  • 200 tests pass (added tests for emoji rendering, table word-wrapping, table constraining at multiple widths, and a comprehensive health report integration test that validates all rendered lines produce valid Spectre markup at various width/wrap combinations)

- Render markdown tables as formatted text with column alignment instead
  of raw markdown pipe syntax
- Add word-wrapping in table cells so content is never truncated
- Preserve short columns (<=12 chars) at natural width; only shrink wide
  columns proportionally when table exceeds available width
- Add scroll loops to health state and run detail pages
- Set UTF-8 output encoding for emoji characters
- Add [M]arkdown toggle to view raw markdown for debugging render issues
- Fix WrapMarkupLine failing on escaped brackets (e.g. [[#83775]]) by
  re-escaping literal bracket chars when rebuilding wrapped output
- Pass ContentWidth to ToMarkupLines so tables are constrained at render
  time rather than relying on panel wrapping which breaks table structure
- Disable truncation in health pages (use wrapping instead)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jaredpar
jaredpar merged commit 95714d2 into main Jun 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant