Cjk Line Break
Containers that may render CJK text MUST set `lang` correctly on the HTML element (lang='ja', 'zh-Hans', 'zh-Hant', 'ko') and use `line-break: strict` (or `normal` with explicit `word-break: keep-all` where words must no…
$ prime install @community/rule-cjk-line-break Projection
Always in _index.xml · the agent never has to ask for this.
CjkLineBreak [rule] v1.0.0
CJK (Chinese/Japanese/Korean) text must use language-aware line-breaking rules. CSS line-break and word-break properties have language-specific semantics that change which characters may start or end a line (kinsoku shori in Japanese).
Containers that may render CJK text MUST set
langcorrectly on the HTML element (lang='ja', 'zh-Hans', 'zh-Hant', 'ko') and useline-break: strict(ornormalwith explicitword-break: keep-allwhere words must not split). Never apply Latin-onlyword-break: break-allto CJK content — it produces grammatically broken lines that violate JIS X 4051 / GB/T 15834 rules. For mixed Latin+CJK, preferoverflow-wrap: anywhereon Latin tokens only or use<bdi>boundaries.
Loaded when retrieval picks the atom as adjacent / supporting.
CjkLineBreak [rule] v1.0.0
CJK (Chinese/Japanese/Korean) text must use language-aware line-breaking rules. CSS line-break and word-break properties have language-specific semantics that change which characters may start or end a line (kinsoku shori in Japanese).
Containers that may render CJK text MUST set
langcorrectly on the HTML element (lang='ja', 'zh-Hans', 'zh-Hant', 'ko') and useline-break: strict(ornormalwith explicitword-break: keep-allwhere words must not split). Never apply Latin-onlyword-break: break-allto CJK content — it produces grammatically broken lines that violate JIS X 4051 / GB/T 15834 rules. For mixed Latin+CJK, preferoverflow-wrap: anywhereon Latin tokens only or use<bdi>boundaries.
Applies To
- Any product surface that renders CJK content (zh, ja, ko)
- User-generated content (comments, posts) that may contain CJK
- Translation files containing CJK target locales
- Text in fixed-width containers (cards, table cells, sidebars)
- Email templates and PDF exports rendered with CSS
Implementation Checklist
- Root reflects active locale; switching languages updates lang attribute
- CJK locales set CSS
line-break: strictandword-break: normal(NOT break-all) - Mixed Latin+CJK tokens use
overflow-wrap: anywhereonly on Latin substrings via - Test fixtures include lines ending in 「 and lines starting with 。 — visual regression must catch kinsoku violations
- Hyphenation (
hyphens: auto) is meaningless for CJK; do not enable for CJK locales
Severity
warn
Counter Examples
- こんにちは、世界— breaks between any two characters including immediately before 、 and after 「, violating kinsoku.
- Missing lang attribute defaults to lang='en' even when content is Chinese — browser uses Latin breaking rules; no kinsoku enforcement.
overflow-wrap: anywhereapplied globally — Latin URL fragments break correctly, but CJK punctuation now appears at line starts.
Loaded when retrieval picks the atom as a focal / direct hit.
CjkLineBreak [rule] v1.0.0
CJK (Chinese/Japanese/Korean) text must use language-aware line-breaking rules. CSS line-break and word-break properties have language-specific semantics that change which characters may start or end a line (kinsoku shori in Japanese).
Containers that may render CJK text MUST set
langcorrectly on the HTML element (lang='ja', 'zh-Hans', 'zh-Hant', 'ko') and useline-break: strict(ornormalwith explicitword-break: keep-allwhere words must not split). Never apply Latin-onlyword-break: break-allto CJK content — it produces grammatically broken lines that violate JIS X 4051 / GB/T 15834 rules. For mixed Latin+CJK, preferoverflow-wrap: anywhereon Latin tokens only or use<bdi>boundaries.
Applies To
- Any product surface that renders CJK content (zh, ja, ko)
- User-generated content (comments, posts) that may contain CJK
- Translation files containing CJK target locales
- Text in fixed-width containers (cards, table cells, sidebars)
- Email templates and PDF exports rendered with CSS
Implementation Checklist
- Root reflects active locale; switching languages updates lang attribute
- CJK locales set CSS
line-break: strictandword-break: normal(NOT break-all) - Mixed Latin+CJK tokens use
overflow-wrap: anywhereonly on Latin substrings via - Test fixtures include lines ending in 「 and lines starting with 。 — visual regression must catch kinsoku violations
- Hyphenation (
hyphens: auto) is meaningless for CJK; do not enable for CJK locales
Severity
warn
Counter Examples
- こんにちは、世界— breaks between any two characters including immediately before 、 and after 「, violating kinsoku.
- Missing lang attribute defaults to lang='en' even when content is Chinese — browser uses Latin breaking rules; no kinsoku enforcement.
overflow-wrap: anywhereapplied globally — Latin URL fragments break correctly, but CJK punctuation now appears at line starts.
Examples
- Japanese paragraph:
— closing 」 stays glued to preceding character; opening 「 stays glued to following character.
- Simplified Chinese card: lang='zh-Hans'; word-break: normal; line-break: strict. Long English URL inside: wrap with .
- Korean (lang='ko'): same kinsoku rules apply; spaces between eojeol are honored —
word-break: keep-allprevents breaking within a word.
Relations
enhances: @community/rule-intl-api-locale-formatting
Rationale
CJK has no inter-word spaces; line-breaking is character-by-character constrained by punctuation rules (kinsoku shori). Closing punctuation (。、」』) must NEVER start a line; opening punctuation (「『) must NEVER end a line. The CSS line-break: strict engine encodes JIS X 4051; loose is acceptable for narrow columns; anywhere is forbidden for body text. Browsers fall back to language-specific rules only when lang is set — defaulting to lang='en' produces visibly broken Japanese paragraphs.
Applies To
- Any product surface that renders CJK content (zh, ja, ko)
- User-generated content (comments, posts) that may contain CJK
- Translation files containing CJK target locales
- Text in fixed-width containers (cards, table cells, sidebars)
- Email templates and PDF exports rendered with CSS
Implementation Checklist
- Root reflects active locale; switching languages updates lang attribute
- CJK locales set CSS
line-break: strictandword-break: normal(NOT break-all) - Mixed Latin+CJK tokens use
overflow-wrap: anywhereonly on Latin substrings via - Test fixtures include lines ending in 「 and lines starting with 。 — visual regression must catch kinsoku violations
- Hyphenation (
hyphens: auto) is meaningless for CJK; do not enable for CJK locales
Severity
warn
Counter Examples
- こんにちは、世界— breaks between any two characters including immediately before 、 and after 「, violating kinsoku.
- Missing lang attribute defaults to lang='en' even when content is Chinese — browser uses Latin breaking rules; no kinsoku enforcement.
overflow-wrap: anywhereapplied globally — Latin URL fragments break correctly, but CJK punctuation now appears at line starts.
Enhances
@community/rule-intl-api-locale-formatting
Source
prime-system/examples/frontend-design/primes/compiled/@community/rule-cjk-line-break/atom.yaml