Spacer: Declarative Inter-Block Spacing Policies#

A Spacer is a small predicate object describing when a pair of adjacent block nodes deserves non-default vertical spacing: it can match on node types, rendered texts, a custom condition function, or any combination of the three. Renderer.render_block_spacing() consults the registered spacers in order and applies the first match.

Declarative Inter-Block Spacing Policies.

A Spacer is a small predicate object describing when a pair of adjacent block nodes deserves non-default vertical spacing: it can match on node types, rendered texts, a custom condition function, or any combination of the three. Renderer.render_block_spacing() consults the registered spacers in order and applies the first match.

class myform.Spacer.Spacer(value: int = 2, *, t0: str | None = None, t1: str | None = None, types: tuple[str, str] | None = None, e0: str | None = None, e1: str | None = None, exprs: tuple[str, str] | None = None, cond: _Condition | None = None, desc: str | None = None)#

A callable spacing policy deciding whether a pair of adjacent blocks gets special spacing.