Skip to content

fix(website): restore the spaces between words and inline code or links - #1105

Merged
jonkwheeler merged 1 commit into
tsrx-org:mainfrom
jonkwheeler:fix/website-inline-spaces
Nov 12, 2026
Merged

jonkwheeler merged 1 commit into
tsrx-org:mainfrom
jonkwheeler:fix/website-inline-spaces

Conversation

@jonkwheeler

@jonkwheeler jonkwheeler commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Website text now has the spaces around inline code, links and string children that the page sources had lost.

Root cause. In the sources, not in a helper. Under JSX's whitespace rules, which React, Preact, Solid and Vue apply, word\n<code> has no space, so the sources were wrong for every target. Most of these boundaries came from the old formatter turning a space between children into a line break (#402, fixed in #459). The edit is a codemod over the parsed TSRX AST, not hand edits, so each boundary gets the same rule:

  • Insert a space between a text child and an adjacent <code>, <a>, <strong>, <em>, <kbd> or {'string'} child when only a line break, or nothing, separates them.
  • No space after (, [, {, / or -: (<code>, if</code>/<code>else.
  • No space before closing punctuation or a plural or possessive suffix: </code>., </code>,, </code>s, </code>'s.
  • One adjacent @switch @case pair of code spans got a {' '} by hand.

That is 1,105 boundaries in 8 pages.

A second cause, outside this repository. The site renders with Ripple, and Ripple's get_template_text_value (@tsrx/ripple, src/template-ast.js, Ripple-TS/ripple) trims every text run that contains a line break: /[\r\n]/.test(value) ? value.trim() : value. JSX trims per line instead. So in Ripple, a space at the edge of a multi-line run is lost, for example the space after "has" in <p>\n TSRX no longer has <code>. JSX keeps it. Prettier normalizes {' '} before an element on the same line back to a plain space, so the sources can't work around it.

  • Under JSX's rules, glued word/inline-element boundaries go from 1,087 to 0.
  • In Ripple's output they go from 1,102 to 579. The other 579 need Ripple to trim per line as JSX does.

Verification

  • Each page, compiled with the Ripple compiler the site uses (mode: 'server') from origin/main and from this branch, gives the same output once whitespace and style hashes are ignored. Only spaces change.
  • Lead paragraph of blog-removing-lazy-destructuring.tsrx, under JSX's rules:
    • before: TSRX no longer has<code>&{ ... }</code>and<code>&[ ... ]</code>. Destructuring…
    • after: TSRX no longer has <code>&{ ... }</code> and <code>&[ ... ]</code>. Destructuring…
    • Ripple, after: TSRX no longer has<code>&amp;{ ... }</code> and <code>&amp;[ ... ]</code>. The first space is lost to the Ripple trim above.
  • npx prettier --check website-tsrx/src, pnpm --filter tsrx-website typecheck and npx vitest run --project website (47/47) pass. Two of four website runs here had one failing test (shiki-codemirror.test.ts in the run whose log was kept). That test checks Shiki highlighting in CodeMirror with vi.waitFor's 1s default and doesn't read the pages, so it looks like a separate flake under load.
  • Full npx vitest run (all three of my branches merged locally, on a machine with load average 50-75 from parallel runs): 10,002 passed, 82 skipped, 10 failed. All 10 are "Test timed out in 5000ms" in projects this PR doesn't touch (content-mapper, typescript-plugin, tsrx-vue). Those three projects pass in full with --testTimeout=60000 (1,284 passed, 15 skipped). pnpm typecheck is clean, pnpm changeset:check passes, and Prettier passes on the changed files.

No changeset: tsrx-website is in the Changesets ignore list, and this is a docs-only change.

Related

Related: #481. This fixes the sources the issue describes and every JSX target. The live site also needs the Ripple trim fix above for the rest.

🤖 Generated with Claude Code


Note

Low Risk
Docs-only JSX whitespace in the marketing site; no product logic, auth, or data handling.

Overview
Fixes missing spaces in the TSRX marketing site copy where words ran into inline <code>, links, and similar children (e.g. has<code>…</code>and instead of has <code>…</code> and).

The updates touch eight website-tsrx pages (blog posts, features, getting started, home, blog index). Prose is reformatted so boundaries between text and inline elements use explicit spaces or {' '} where JSX would drop a newline-only gap—mostly fallout from Prettier line breaks (#459) and JSX whitespace rules, applied via an AST codemod per the PR description.

No compiler, runtime, or API changes—only how documentation renders. Full spacing on the live Ripple-built site may still need a separate Ripple text-trim fix (#481).

Reviewed by Cursor Bugbot for commit 0d37b0d. Bugbot is set up for automated code reviews on this repo. Configure here.

…ks (tsrx-org#481)

The page sources separated words from `<code>`, `<a>` and string children
with a line break only (`has\n<code>…</code>\nand`), or with nothing at all
(`a<code>`, `,<code>`). Whitespace that contains a line break is layout in
JSX, so the text read "TSRX no longer has&{ ... }and&[ ... ]." in every
target. Most of these came from the old formatter turning a space between
children into a line break (tsrx-org#402, fixed in tsrx-org#459).

A codemod over the parsed TSRX AST put a space at each such boundary, except
after an opening bracket or a slash (`(<code>`, `if</code>/<code>else`) and
before closing punctuation or a plural suffix (`</code>.`, `</code>s`); one
`@switch` `@case` pair got a `{' '}` by hand. Prettier then laid the
paragraphs out again. 1,105 boundaries in 8 pages changed.

Each page compiles, with the Ripple compiler the site uses, to the same output
except for whitespace. Under JSX's whitespace rules (React, Preact, Solid,
Vue), the glued word/inline-element boundaries go from 1,087 to 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jonkwheeler
jonkwheeler marked this pull request as ready for review October 26, 2026 19:57
@jonkwheeler
jonkwheeler merged commit 46bc795 into tsrx-org:main Nov 12, 2026
8 checks passed
jonkwheeler added a commit that referenced this pull request Nov 14, 2026
…nd inline elements (#1337)

* fix(website): build the site with a Ripple that keeps the spaces around inline elements

#1105 restored the spaces between words and inline code or links in the
website's sources, but the site still rendered most of them glued
("TSRX no longer has<code>&{ ... }</code>"): it builds with
`@ripple-ts/vite-plugin` 0.4.0, which pins `@tsrx/ripple` 0.2.0, and that
compiler drops a space at the edge of a multi-line text run. Ripple-TS/ripple
#1608 fixed the trim in `@tsrx/ripple` 0.2.8.

Move the Ripple packages the workspace builds with to the current release:
`ripple`, `@ripple-ts/vite-plugin` and `@ripple-ts/adapter-node` 0.6.1, whose
plugin uses `@tsrx/ripple` 0.2.11, and resolve the workspace's own
`@tsrx/ripple` to 0.2.11 as well. The catalog range of `@tsrx/ripple` stays
`^0.2.0`, so the optional peer range `@tsrx/typescript-plugin` publishes
doesn't change. The release-age exclusions for the 0.4.0/0.2.0 releases go
with them.

Also put back the one space the sources still lacked, before
`TSRX3014` in the specification (added by #1130 beside #1105).

Fixes #481

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRKmwAwuyPbGQ1ejNqiJ46
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