frontend: indent the line a break starts, not just the paragraph's first

A Chinese manuscript indents the first line of every paragraph by two
characters, and the paragraph body carried `text-indent: 2em` for it. CSS
indents only the *first line of a block*, and the body was one block — so the
opening line was indented and every line the writer broke (with 另起一行, or
after a display formula) started flush against the margin, where a new
paragraph should be indented. The bug was invisible until the break flag
existed, because until then a paragraph had no interior line starts.

The renderer now groups a paragraph into printed lines and makes each one its
own block, with the indent on the line rather than on the paragraph:

* the paragraph's first line — indented, as before;
* a line the writer broke — indented, which is the fix;
* a line after a display formula — **not** indented, because that text
  continues the same paragraph and a Chinese manuscript does not indent a
  continuation;
* a display formula's own line — centred, no indent.

Measured in the browser on a paper built for it: the first line starts 30px in
(2em at 15px), the broken line starts 30px in, the formula sits on its own
centred line, and the text after it returns to 0. Paper 96 is unchanged at 21
paragraphs, all 21 still indented 30px, 28 display formulas, no render
failures. 54 paper checks, 61 reference checks and 99 MCP checks pass, with the
build clean.
This commit is contained in:
2026-09-23 13:06:12 +08:00
parent 9f2bbe50eb
commit c65efa32ac
2 changed files with 108 additions and 38 deletions
+9
View File
@@ -323,6 +323,15 @@ A break also **replaces** the separator rather than adding to it: the new line
already separates the two sentences, and a space as well would indent the line
by one blank.
The renderer groups a paragraph into *printed lines* to make that work. CSS can
only indent the first line of a block, so a paragraph printed as one block
indents its opening line and leaves every line the writer broke flush against
the margin — which is exactly where a new paragraph should be indented. So each
printed line is its own block, and the two-character first-line indent sits on
the line rather than on the paragraph. A line after a display formula is the
exception: that text continues the same paragraph, and a Chinese manuscript
does not indent a continuation.
#### What goes at the seam
A paragraph is printed by concatenating its sentences in `sort` order, so the