fix(ui): wrap text at words, not mid-character - #27
Merged
Conversation
md-editor-v3's stylesheet sets `word-break: break-all` on `.md-editor-preview` and `.md-editor-html`. `word-break` is inherited, so every descendant of a rendered-markdown block picked it up and split ordinary words down the middle — card bodies, comments, changelog entries and the welcome block alike. It also defeated the `overflow-wrap: anywhere` those components already set, which on its own would have broken only words that genuinely cannot fit. Reset it globally rather than per component, since the preview is rendered from several call sites. Three details in the reset are load-bearing and are spelled out in the comment above it: the doubled class (the library's CSS rides in a lazy chunk, so source order cannot decide the winner); the explicit `th`/`td` (the default theme sets the legacy `word-wrap` alias on cells, which overrides what they would inherit); and `anywhere` rather than `break-word` (links render as `display: inline-flex`, and a flex item will not shrink below its min-content width, which only `anywhere` reduces — under `break-word` a long link overflows its column instead of wrapping). The board list's card excerpt carried the same `break-all` inline; it becomes `break-words`, which still contains a runaway URL without chopping prose. Left alone: the `break-all` on the bare fallback link in the e-mail templates, where breaking anywhere is the point. The editor input is untouched — CodeMirror already wraps at word boundaries. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EcBReeukM2hnDV9Pau1jyA Signed-off-by: Quadcom <admin@quadcom.ca>
quadcom
pushed a commit
to quadcom/feedlog-token
that referenced
this pull request
Aug 27, 2026
fix/word-wrap is cut from upstream and is open as PR linkcraftstudio#27 there. Merging rather than cherry-picking keeps the same commit id on both sides, so when upstream takes the fix this history reconciles instead of duplicating it. The token PR branch is untouched: it does not descend from this merge. Note that main is no longer a safe base for a new PR branch — cut those from upstream/main.
Contributor
|
Thanks for the thoughtful contribution—this significantly improves Markdown text wrapping across FeedLog! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Stops rendered markdown wrapping mid-word. Two changes:
app/assets/css/tailwind.css— reset theword-break: break-allthatmd-editor-v3applies to its preview containers, restoring normal word wrapping everywhere markdown is displayed.app/pages/index.vue— swap the board list excerpt'sbreak-allforbreak-words.Presentation only. No schema, API, env or dependency changes.
Why
No issue filed — reported by a self-hosting user, reproduced against
main.md-editor-v3's stylesheet setsword-break: break-allon.md-editor-preview, on.md-editor-html, and on.md-editor-preview h1–h6.word-breakis inherited, so the whole rendered subtree picks it up and the browser may break between any two characters — even when the word would have fitted on the next line:That affects every surface that renders markdown: post bodies (
PostContent.vue), comments (CommentContent.vue), the portal welcome block (PortalWelcomeBlock.vue), changelog entries, and the editor'spreviewOnlypane. It also silently defeats theoverflow-wrap: anywherethatPostContent.vue,CommentContent.vueandmd-editor-preview.cssalready set — that rule alone breaks only a word that genuinely cannot fit, which is the intended behaviour.app/pages/index.vuehad the samebreak-allapplied directly to the card excerpt, producing the effect on every summary on the board list.The editor input is not affected and is unchanged here. CodeMirror already wraps at word boundaries; the reported "it breaks while I type" turned out to be the preview beside it. Worth knowing if the same report reaches you.
How to review
Three things in the reset are deliberate and would look arbitrary without explanation. All three are also written into the comment above the rule.
1. The doubled class.
md-editor-v3's CSS is imported insideThemedMdEditor.vue/ThemedMdPreview.vue, so it ships in a lazily-loaded chunk and its order relative to the global stylesheet is not guaranteed. The reset cannot rely on coming last, so it wins on specificity instead: two classes out-rank the library's one, without!important.2.
th/tdare listed explicitly. The default preview theme sets the legacyword-wrapalias on cells:That overrides what cells would otherwise inherit from the container, so without naming them a table containing a long URL stops wrapping and pushes the table wider than its column.
3.
anywhererather thanbreak-word. This one is easy to get wrong. The library renders links asdisplay: inline-flex, so a bare URL becomes a flex item, and a flex item will not shrink below its min-content width. Onlyanywherereduces min-content — underbreak-worda long link keeps its full width and overflows the column instead of wrapping. I hadbreak-wordfirst and it visibly regressed exactly this case.Deliberately not changed: the
word-break: break-allon the plain-text fallback link inserver/utils/email-templates.ts, where breaking a bare URL anywhere is the point.Verifying it
The change was checked against a live
md-editor-v3v6.4.2 instance rendering a document that mixes long ordinary words with unbreakable URLs in a heading, a paragraph, a list item, a table cell, a blockquote and an inline code span, in a ~300px column. Before: prose broken mid-character throughout. After: every word intact, every URL still broken (only where it cannot fit), and nothing overflowing its container in any of those contexts.To reproduce, post a card whose body contains several long words plus a long URL in each of those constructs, then view it narrow on the board list, the post detail, a comment, a changelog entry, the welcome block, and the editor's preview toggle.
Checklist
git commit -s)pnpm build)