Text paragraph (source code)

= Text paragraph

A \b[text paragraph] is a group of text treated as one unit for paragraph layout. Its <line breaking> may change when the available <typesetting line width> or <computer font> changes, while its underlying paragraph boundary remains the same. A line in the source file therefore need not be a line of displayed output.<CSS Text Module Level 3 by World Wide Web Consortium>[§3: white-space processing, wrapping and preserved versus collapsed segment breaks]{ref}

For example, a sequence of four <typesetting boxes> may occupy two lines in a narrow container and one line in a wider container. Reflow changes the grouping of boxes without requiring a new paragraph. In <TeX>, `\par` ends the current paragraph; in <HTML>, a `p` element marks a paragraph. Those mechanisms let the layout system work with a semantic group instead of relying on the writer to insert each visible line break.

The <Knuth-Plass line-breaking algorithm> uses this grouping to compare costs across the whole paragraph. Its <typesetting demerits> can depend on both individual lines and changes between neighbouring lines, which cannot be evaluated by inspecting each source line in isolation.