Repository navigation
fix(components): text boxes keep paragraph breaks and non-Latin headings get ToC anchors - #304
Conversation
…ts no anchor `slugify` kept only a-z and 0-9, so every heading in a non-Latin script collapsed to '': the RichText heading converter emitted no `id`, and the table of contents linked each such entry to `href="#"`, which scrolls to the top. Of the 121 non-Latin headings live in SahajCloud today (bg, el, hy, ru, uk), 112 had no anchor at all and nine kept only their digits. Letters, marks and digits of any other script now stay in the anchor, lowercased, with everything else collapsing to "-". A Latin letter still folds its diacritics (é becomes e); a letter of another script keeps its marks (й stays й, ά stays ά), recomposed with NFC. Armenian writes its question, exclamation and emphasis marks inside the word (Ի՞նչ), so those drop rather than split it. Latin output is unchanged on purpose: an anchor already in a shared link or an editor's `#` link has to keep resolving. Latin and script-neutral characters outside a-z and 0-9 still separate, so ß, ı, œ and ł split a word exactly as before. Across all 2,924 Latin headings live in SahajCloud the old and new anchors are byte-identical, and the new spec pins a sample of them. Two equal headings still share one id; that is #266, which waits on the upstream `occurrence` field. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
The `textbox` block reaches one of three organisms, and they treated a paragraph break three ways. OrnateTextBox split its text into one <p> per paragraph; ContentTextBox and ContentOverlay rendered the whole string in a single <p>, so the breaks SahajCloud stores collapsed into one run of text. ContentOverlay could already render an array of paragraphs, but the converter hands it a string. OrnateTextBox's split moves to `lib/paragraphs.ts` and all three render through it, so a break reads the same whichever style an editor picks. Every run of line breaks starts a paragraph, not only a blank line: that is the rule OrnateTextBox already shipped, and the one live text that uses a single break (/mooladhara-chakra's overlay) uses it to start each tip. ContentTextBox's paragraphs sit directly in its gap-6 column, which spaces them at 1.5rem, prose-lg's paragraph margin for this text size. Single-paragraph text renders byte-identical: of the 40 English text boxes live in SahajCloud, 37 render exactly as before. The other three are /mooladhara-chakra's multi-paragraph overlay, and two overlays with no text, which lose an empty <p class=""> that drew nothing. An empty description no longer leaves an empty <p> in ContentTextBox's column either (no live side box has one). The ContentTextBox story gains a two-paragraph example. Closes #286. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
…it was Keeping a non-Latin letter's marks let every other combining mark through as well. Only U+0300-036F was handled, and the separator never matches a mark, so an emoji's variation selector or keycap and a mark such as U+20D7 after a Latin letter stayed in the id: "We ❤️ meditation" became "we-<U+FE0F>-meditation", an emoji-only heading got an invisible id instead of none, and "🧘♀️ Yoga" an id that starts with U+FE0F. The script check also ran after NFKD, so µ and ℵ were already Greek and Hebrew letters and stayed in a Latin heading's anchor. Each Latin or script-neutral character now folds on its own before the text decomposes, exactly as every anchor was spelled before. A run of marks is kept only after a letter of another script, and otherwise folds the same way. Over every string made only of Latin, Common and Inherited code points (each one alone and in context, plus 300,000 random strings), the result equals origin/main's. Over all 3,046 live headings and ToC entries in 19 locales, no anchor differs from the previous commit's, and none of the 121 non-Latin headings is empty. The ohm sign (U+2126) is Greek script in Unicode, so it stays as ω like any other Greek letter. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-web | 6ac4922 | Commit Preview URL Branch Preview URL |
Nov 19 2026, 09:25 PM |
|
Review answered. Nothing pushed: the one ask is a question, and I built nothing on a guess. Thread — a slug library, or SahajCloud's slug — answered, left open. Nothing upstream stamps a heading id, so the id is derived here whichever rule wins. Measured on live content: SahajCloud's own
PR body: the first bullet claimed non-Latin readers can now use the table of contents. No live page carries both a ToC block and a non-Latin heading, so today's gain is the heading anchor itself. Corrected, with the measurements under Not in this PR. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
Review answered. Nothing pushed: the ask was answered B, which is a ticket, not a code change. Thread — a slug library, or SahajCloud's slug — resolved. The work joins #266, the open ticket for duplicate heading ids: the same files, and the same requirement that existing ids not move. It now carries the choice as open question 1, so Found while grounding it, added to #266 and to the body: SahajCloud already spells the layout block's tab anchors with the PR body: the Not in this PR bullet no longer says the thread holds the merge, and
🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-design | 6ac4922 | Commit Preview URL Branch Preview URL |
Nov 19 2026, 09:25 PM |
#304 merged, so lib/paragraphs.ts arrived on main as an add/add conflict. Both sides hold the same function; kept this branch's doc comment, which also names HeroQuote, now that HeroQuote renders through toParagraphs. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVUbtF4Dek2YdSL8fe
Summary
id, so nothing could link to it, and a ToC entry for one renderedhref="#", which only jumped to the top of the page. Now the heading's anchor uses its own letters (#какво-е-кундалини,#τα-οφέλη-του-διαλογισμού), and a ToC entry links to that anchor. No live page carries both a ToC block and a non-Latin heading today, so the ToC half of this reaches visitors once an editor adds one.#links that editors typed, still work. An emoji, a keycap or the micro sign in a Latin heading still never ends up in its anchor.lib/paragraphs.ts(toParagraphs) is now the one paragraph rule forContentTextBox,ContentOverlayandOrnateTextBox.lib/slugify.tsis still the single function shared by the heading converter and the ToC block, so heading ids and ToC links always match. TheContentTextBoxLadle story has a new "Paragraphs" section.Findings addressed
slugifyreturned''for Cyrillic, Greek, Armenian and Persian.origin/main,lib/slugify.ts:22kept only[a-z0-9]. Both callers use this function:components/molecules/blocks/TableOfContents/TableOfContents.tsx:46(href={#${anchor}}) andcomponents/organisms/RichText/RichText.tsx:107(the headingid).main, 112 of them had no anchor and 9 kept only their digits (1,2018). With this branch, none of them has an empty anchor.main's. Every Latin, Common and Inherited code point gives the same anchor as onmain, alone and in context, and so do 300,000 random strings made of those code points.mainfolds it. This happens before the text is decomposed, so µ and ℵ never turn into a Greek or a Hebrew letter.lib/slugify.test.ts. The Latin cases are taken from live headings, plus a separate set for emoji, keycaps and µ. There are also non-Latin cases and cases that give no anchor.TableOfContents.test.tsx: "links a heading in a non-Latin script to its anchor, not to "#"".RichText.test.tsx: "anchors a non-Latin heading, and the table of contents links to the same id".main. The emoji, keycap and µ cases fail on the branch's first version of the fix (4430b06).OrnateTextBoxand not at all inContentTextBoxandContentOverlay(string input).origin/main,ContentTextBox.tsx:140rendereddescriptionin a single<p>, andContentOverlay.tsx:114wrapped a string as[text].toParagraphs(lib/paragraphs.ts:10). It splits on every run of line breaks, trims each paragraph, and drops empty ones. That is the ruleOrnateTextBoxalready used./mooladhara-chakra) uses it to start each tip./mooladhara-chakraoverlay now splits, as intended. Two overlays with no text (app-privacy-policy,meditate-america) lose an empty<p class="">that drew nothing.lib/paragraphs.test.ts.ContentTextBox.test.tsxandContentOverlay.test.tsxpin the exact single-paragraph<p>markup. These pass before and after the change. They also check that two paragraphs render as two<p>elements; that check fails onmain.blockConverters.test.tsxadds "paragraph breaks", which covers the white-box, ornate and overlay styles. The white-box and overlay cases fail onmain.Not in this PR
slugon each ToC entry, computed with theslugifypackage, but nothing upstream stamps an id on the heading itself, so the id is derived here whichever rule wins. Measured on the live content: the stored slug already equals this branch's anchor on 1,103 of 1,135 ToC entries, and the 32 that differ are&(terms-and-conditions) and a decimal point (81-what-we-share). Adopting the package here would move 66 of 1,789 live Latin anchors, cut all 12 live Armenian headings to stubs (Մաս 1. Ուղիներ→m-1) and collide two headings on one page.çıkış→c-k-s. This is on purpose: changing it would change Latin anchors that already exist. Folding them (ß → ss, ı → i) would be a separate decision.href="#". No live heading looks like this.occurrencefield that chore(contracts): re-sync copied contracts from SahajCloud #292 brings in.subtitleinContentTextBoxstays a single<p>. It is a one-line field, and the fix(textbox): a multi-paragraph text box renders as one block #286 acceptance criteria cover only the body text.Reconciled with open PRs
components/organisms/RichText/blockConverters.test.tsx. This PR adds a newdescribeafter the textbox-routing block, and feat(components): a MeditationLibrary for the meditations index block #293 edits the content-indexdescribe. This PR does not touchblockConverters.tsxorlib/content-blocks.ts.git merge-treeof this branch's head against each open PR branch reports no conflicts: feat(server): legacy redirect map and lookup for the wemeditate.com cutover #276, feat(seo): share metadata and JSON-LD at parity with the old site #282, feat(components): add a mobile menu, and make the compact bar the phone's header #283, feat(player): move VideoPlayer from Vidstack to Video.js 10 #285, feat(server): switch wemeditate.com over to the new site #288, feat(preview): stream unsaved lecture edits into the preview panel #290, chore(contracts): re-sync copied contracts from SahajCloud #292 and feat(components): a MeditationLibrary for the meditations index block #293.occurrence?: numbertype, and touches none of these files.Closes #286
Notes for reviewer
duplicate heading ids: the same files, and the same requirement that existing ids not move. It
carries the question as open question 1, with three options and a recommendation, so
@sydevs-bot implementthere waits until it is answered.slugifypackage (src/lib/richEditor/blocks/LayoutBlock.ts:12) and this repo renders them as alink href (
LayoutBlock.tsx:139), while the heading id they would land on is spelled bylib/slugify.ts. The storedTocHeading.slugis read by nothing.revisit.
Test results
Lean gate (
.claude/skills/pr-prep/check.sh) on the head commit:origin/mainbaseline.tsc --noEmit: passed.pnpm build: not run, because this bundle is not a build bundle.🤖 Generated with Claude Code
https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw