Skip to content

fix(styles): break long table code at its separators first - #14

Merged
aicayzer merged 1 commit into
mainfrom
fix/table-code-breaks
Nov 29, 2026
Merged

aicayzer merged 1 commit into
mainfrom
fix/table-code-breaks

Conversation

@aicayzer

Copy link
Copy Markdown
Contributor

Summary

Long inline code in a table cell, such as mcp_fetch_timeout_seconds, could break inside a word (mcp_fetch_timeout_second and s) because a plain underscore is not a line-break opportunity and the stylesheet's overflow-wrap fallback broke the word wherever the line ran out. rehypeTableLabels now adds a <wbr> after each _, -, . and /, and before the capital of a camelCase word, in code longer than 24 characters in a table cell, so the line breaks at the code's own seams first and overflow-wrap stays the last resort. A <wbr> adds no character, so copying the code gives its text unchanged. Closes #13

Changes

  • src/lib/table-labels.ts: add <wbr> break opportunities to long inline code in table cells (also inside highlighted spans). Code in a block, code outside a table and short code are untouched. A nested table is handled once.
  • src/lib/table-labels.test.ts: tests for the break points, the copied text, short code, consecutive and trailing separators, spans, blocks, prose and nested tables.
  • README.md and a styles.css comment describe the behavior.

Testing

  • pnpm types:check, pnpm test, pnpm build and pnpm pack:check pass.
  • The four new behavior tests fail with the plugin step disabled and pass with it.
  • Not tested yet: the rendered result in a browser. It is checked on docs.marfa.so's Limits page after the release is deployed there.

Notes for reviewers

Small, contained change to one build-time plugin; no change to exports or class names.

Checklist

  • The title is a scoped Conventional Commit.
  • New behavior has a test that was seen failing first, or no test was needed and the reason is above.
  • Docs, comments and the contract still say what is true after this change.

@aicayzer
aicayzer marked this pull request as ready for review November 29, 2026 21:30
@aicayzer
aicayzer merged commit 0a18abf into main Nov 29, 2026
10 checks passed
@aicayzer
aicayzer deleted the fix/table-code-breaks branch November 29, 2026 21:31
@aicayzer aicayzer mentioned this pull request Nov 29, 2026
3 tasks done
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.

Code in a table's value cells can break mid-word

1 participant