Expand description
Pure logic for zenith render.
Public entry points:
to_scene_json— parse → validate → compile → scene JSON string.to_png— parse → validate → compile → PNG bytes (no assets).to_png_with_dir— liketo_png, with asset directory, lock, and policy flags.to_pdf_with_dir— parse → validate → compile → PDF bytes (one page).to_pdf_all_pages_with_dir— render every page into one multi-page PDF.to_png_all_pages— render every page to PNG.to_png_spread— render a two-page spread to PNG.
All operate entirely on in-memory source text; the caller is responsible for all filesystem I/O.
This module is split across concern-grouped submodules:
entry— the error type, render artifacts, and the public entry points.assets— font/asset provider construction and disk-based diagnostics.pipeline— shared parse/validate/page-resolution/hash helpers.data_input— load aDataContextfrom a JSON or CSV file (--data).
Re-exports§
pub use data_input::DataInputError;pub use data_input::load_data_context;
Modules§
- data_
input - Data-context loading from JSON or CSV files for
zenith render --data.
Structs§
- PdfArtifact
- Rendered vector PDF bytes plus the compile-stage diagnostics that produced them.
- PngArtifact
- Rendered PNG bytes plus the compile-stage diagnostics that produced them.
- Render
CmdErr - Error produced by the render command.
- Scene
Artifact - Scene JSON plus the compile-stage diagnostics that produced it.
- Spread
Render Opts - Bundled render options for
to_png_spread, keeping its argument count within the lint limit (the spread path also takes two page indices and a gutter override).Copyso it cascades cheaply.
Functions§
- collect_
image_ dimension_ diagnostics - Collect
image.overflowandimage.upscaleadvisories for all image nodes in the document. - to_
pdf_ all_ pages_ with_ dir - Parse
src, validate it with the merged diagnostic policy, compile EVERY page (in document order, page 1 first), and render them into a single multi-page vector PDF, sourcing image/SVG and font asset bytes fromproject_dirwhen provided (exactly liketo_pdf_with_dir). - to_
pdf_ with_ dir - Parse
src, validate it with the merged diagnostic policy, compile the requestedpage, and render a vector PDF, sourcing image/SVG and font asset bytes fromproject_dirwhen provided (exactly liketo_png_with_dir). - to_png
- Parse
src, validate it, compile the scene, and return PNG bytes. - to_
png_ all_ pages - Parse
src, validate it with the merged diagnostic policy, and render EVERY page to PNG, returning onePngArtifactper page in document order (page 1 first). - to_
png_ spread - Parse
src, validate it with the merged diagnostic policy, compile pagespage_aandpage_b(both 1-based), composite them side by side (A on the left, B on the right), and return the spread PNG bytes plus the merged compile-stage diagnostics. - to_
png_ with_ dir - Like
to_png, but sources image and SVG asset bytes fromproject_dir(the.zenfile’s parent directory) when provided, and honours the merged diagnostic policy. - to_
scene_ json - Parse
src, validate it with the merged diagnostic policy, compile the requestedpage(1-based), and return the scene JSON plus the compile-stage diagnostics.