/** * Forced line breaks inside a paragraph (#620): the parser writes a * backslash ending a source line, or `\\`, as `BREAK_PLACEHOLDER` (U+2028, * LINE SEPARATOR). The text between two breaks is broken on its own, by * whichever breaker sets the paragraph (Knuth–Plass or line by line, the * word-by-word breaker or the CJK composer): a forced break splits a * Knuth–Plass paragraph into independent problems (the break is an infinite * penalty after glue that fills the line), so breaking each piece alone * finds the same lines. The pieces are then stacked as one paragraph: * * - every option that counts lines counts them through the whole paragraph: * a piece that starts on line `n` gets the indents, the measures * (`restWidths`), the lines that should not end on a hyphen * (`avoidHyphenAtLines`) and the kept breaks (`keepBreaks`) of lines * `n`, `n + 1`…; * - the line before a break is set at its natural width, as a paragraph's * last line is (`isLastLine`), and flagged `hardBreak`; * - the runt penalty and `lastLineRunt` are the last piece's, the * paragraph's end; `looseness` is taken by the last piece that can take * it, then the one before; * - the break trace (`MeasuredBlock.breaks`) numbers the item positions of * piece `k` from `k × PIECE_STRIDE`, so a trace cut to its first lines * still tells each piece its own. * * Two breaks in a row are one (the parser merges them); a piece with no * text sets no line. */ import type { InlineSpan } from '../parse/types.js'; import type { MeasureBlockOptions, MeasuredBlock } from './types.js'; /** The forced line break in a paragraph's text (`BREAK_PLACEHOLDER`). */ export declare const FORCED_BREAK = "\u2028"; /** Where the item positions of each piece start in a combined break trace. */ export declare const PIECE_STRIDE: number; /** The spans cut at the forced breaks, the breaks dropped. A span set * whole (a reference, a formula) holds none. */ export declare function splitAtForcedBreaks(spans: readonly InlineSpan[]): InlineSpan[][]; /** The options of the piece that starts on line `n` of the paragraph * (see the module comment). */ export declare function pieceOptions(options: MeasureBlockOptions | undefined, maxWidthPx: number, piece: number, n: number, last: boolean, looseness: number): MeasureBlockOptions; /** * Measure a paragraph whose spans hold forced line breaks (see the module * comment): `measurePiece` breaks the text of one piece with the options * given, as the paragraph's own breaker would. */ export declare function measureForcedBreaks(spans: readonly InlineSpan[], maxWidthPx: number, lineHeightPx: number, options: MeasureBlockOptions | undefined, measurePiece: (piece: InlineSpan[], options: MeasureBlockOptions) => MeasuredBlock): MeasuredBlock; //# sourceMappingURL=hardBreaks.d.ts.map