pub struct Page {Show 19 fields
pub id: String,
pub name: Option<String>,
pub width: Dimension,
pub height: Dimension,
pub background: Option<PropertyValue>,
pub bleed: Option<Dimension>,
pub margin_inner: Option<Dimension>,
pub margin_outer: Option<Dimension>,
pub margin_top: Option<Dimension>,
pub margin_bottom: Option<Dimension>,
pub baseline_grid: Option<Dimension>,
pub line_jumps: Option<String>,
pub safe_zones: Vec<SafeZone>,
pub folds: Vec<Fold>,
pub block_styles: Vec<BlockStyle>,
pub parity: Option<String>,
pub master: Option<String>,
pub children: Vec<Node>,
pub source_span: Option<Span>,
}Expand description
A single page within a document body.
Fields§
§id: String§name: Option<String>§width: DimensionPage width — required.
height: DimensionPage height — required.
background: Option<PropertyValue>§bleed: Option<Dimension>Optional uniform print-bleed margin applied to all four sides. When this
resolves to a positive pixel value b, the rendered media box expands to
(width + 2b) × (height + 2b), all page content shifts into the inner
trim box [b, b, width, height], the background fills the entire media
box (bleeding off the trim edge), and crop/trim marks are auto-drawn in
the bleed margin at the four trim corners. None or a non-positive value
renders byte-identically to a page with no bleed.
margin_inner: Option<Dimension>Book live-area margin (gutter side). With document mirror_margins=true
this is the BINDING-side margin: it sits on the LEFT for a recto (odd,
1-based) page and on the RIGHT for a verso (even) page. Without mirroring
it is treated uniformly as the left margin. None → no inner margin.
Margins are v0 METADATA + VALIDATION ONLY: they describe the intended
live area and drive the margin.violation advisory, but they do NOT
auto-reposition arbitrary page nodes (that is the job of master pages /
flow frames). See crate::validate()’s margin check.
margin_outer: Option<Dimension>Book live-area margin (fore-edge side). The mirror of Page::margin_inner:
with mirror_margins=true it sits on the RIGHT for a recto page and on
the LEFT for a verso page; without mirroring it is the right margin.
None → no outer margin. Metadata + validation only (see margin_inner).
margin_top: Option<Dimension>Book live-area top margin. None → no top margin. Metadata + validation
only (see Page::margin_inner).
margin_bottom: Option<Dimension>Book live-area bottom margin. None → no bottom margin. Metadata +
validation only (see Page::margin_inner).
baseline_grid: Option<Dimension>Optional baseline-grid pitch in pixels. When this resolves to a positive
pixel value g, every text node on this page snaps its line baselines onto
the grid { 0, g, 2g, ... } measured from the page top (y=0): the first
line’s baseline moves DOWN to the next grid line at or below its natural
position, and the effective inter-line advance becomes the smallest multiple
of g that is ≥ the resolved line-height, so corresponding lines align
horizontally across columns. None or a non-positive value renders
byte-identically to a page with no grid. KDL: baseline-grid=(px)14.
line_jumps: Option<String>Optional page-level line-jump style for connector-vs-connector crossings.
When Some("arc") or Some("gap"), every place where two top-level
connectors cross gains a deterministic hop on one of the two strokes (a
small semicircular bump for arc, a broken gap for gap) so overlapping
connectors read clearly. Some("none"), None, or any unrecognized value
renders byte-identically to a page with no line jumps. An unrecognized
value is surfaced as a validation warning (page.invalid_line_jumps).
safe_zones: Vec<SafeZone>Author-declared safe/dead zones for this page. These are not rendering nodes; the validator checks page children against them.
folds: Vec<Fold>Author-declared fold-line positions for this page (tri-fold/bi-fold print). These are non-printing page metadata, not rendering nodes; the validator advises when content crosses a fold line.
block_styles: Vec<BlockStyle>Per-role markdown block style declarations at page scope. Empty when no
block role="…" children are declared on this page. Cascade precedence:
page < text (the text node’s own decls override these). block decls are
data-only in this unit; the layout engine consumes them later.
parity: Option<String>Optional explicit recto/verso parity OVERRIDE for this page. Some("recto")
or Some("verso") forces this page’s parity regardless of its 1-based
position and the document page_parity_start. None (default) → parity is
derived from the page position and the document start parity. An invalid
value is preserved verbatim and surfaced as a validation warning
(page.invalid_parity); it then falls through to the derived parity. See
Document::page_is_recto.
master: Option<String>Optional master-page reference. When Some(id) names a declared
MasterDef, the master’s nodes (running heads, folios, TOC refs) are
projected UNDER this page’s own children at compile time — the master’s
Field nodes are resolved against this page’s
index/parity. An unknown reference is a hard master.unknown_reference
validation error. None → the page has no master (renders as before).
children: Vec<Node>Child content nodes in z-order (first = bottommost, last = topmost).
source_span: Option<Span>Source declaration span, when available.