Honor Markdown pipe-table column alignment in ConsoleTableRenderer#143
Conversation
boxofyellow
left a comment
There was a problem hiding this comment.
@copilot are you sure it is working?
Good catch — the original commit set |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #143 +/- ##
==========================================
- Coverage 95.82% 95.80% -0.02%
==========================================
Files 30 30
Lines 1676 1694 +18
Branches 176 179 +3
==========================================
+ Hits 1606 1623 +17
Misses 46 46
- Partials 24 25 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: boxofyellow <54955040+boxofyellow@users.noreply.github.com>
Co-authored-by: boxofyellow <54955040+boxofyellow@users.noreply.github.com>
32455cb to
5f47530
Compare
Markdig's pipe-table extension records per-column alignment in
Table.ColumnDefinitions[i].Alignment, butConsoleRendererBase.TableFramewas constructing Spectre.ConsoleTableColumns without it, so every column rendered left-aligned regardless of:---,:---:, or---:in the source.Changes
ObjectRenderers/Frames/ConsoleRendererBase.TableFrame.cs: In the column-creation branch ofAddRow, mapTableColumnAligntoJustifyand assign it to the newTableColumn. A bounds check covers the case whereColumnDefinitionsis shorter than the widest row.RendererTests_TableColumnAlignment_HonorsMarkdownAlignmentand..._DefaultsToLeftWhenUnspecifiedthat inspectrenderer.Root's inner SpectreTable.Columns[i].Alignmentdirectly (the existingTextValidationdebug-mode output cannot show alignment because each cell is rendered as a nestedTable, which Spectre always positions at the left of its parent cell). Also added atableAlignment.md/.txtresource pair for regression coverage.docs/CHANGELOG.md: Entry under Upcoming Changes.