Skip to content

Conversation

@dgageot
Copy link
Member

@dgageot dgageot commented Jan 20, 2026

No description provided.

Use lipgloss.Width() instead of runewidth.StringWidth() when calculating
table column widths and padding. runewidth.StringWidth() counts ANSI
escape sequences as characters, causing misaligned columns when cells
contain inline markdown (bold, italic, code) that renders to ANSI codes.

Assisted-By: cagent
- Introduce tableCell struct to pre-render cells during parsing,
  avoiding duplicate renderInline() calls
- Replace strings.Split with manual parsing in parseAndRenderTableRow
  to avoid slice allocations
- Write directly to output buffer instead of intermediate builders
- Pre-calculate separator line once and reuse it
- Replace strings.Repeat for padding with byte-by-byte writes
- Use strings.SplitSeq for blockquote line iteration
- Use max() builtin for content width calculation

Benchmark results show ~36% faster execution, 44% less memory usage,
and 68% fewer allocations for table rendering.

Assisted-By: cagent
@dgageot dgageot requested a review from a team as a code owner January 20, 2026 18:30
@rumpl rumpl merged commit d05fd9a into docker:main Jan 20, 2026
5 checks 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.

2 participants