Skip to main content

Crate cascivo_html

Crate cascivo_html 

Source
Expand description

Renders agent-written .cv text into one deterministic, self-contained cascivo HTML file.

The library has no dependencies and does no file I/O: pass images and brand files through Options. The cascivo-html CLI (crate cascivo-html-cli) wires files for you.

use cascivo_html::{render, Options};

let html = render("@title \"Hi\"\ncard \"Hello\"\n", &Options::default()).unwrap();
assert!(html.starts_with("<!doctype html>") || html.contains("<html"));
assert!(html.contains("Hello"));

GUIDE and guide_for return the agent cheat sheet. Full guide: https://cascivo.com/docs/guides/using-cascivo-html.

Re-exports§

pub use ast::BrandItem;
pub use ast::Directive;
pub use ast::Doc;
pub use ast::Node;
pub use ast::Value;
pub use brand::Brand;
pub use brand::parse_brand_file;
pub use catalog::ArgKind;
pub use catalog::ArgSpec;
pub use catalog::Children;
pub use catalog::ClientJs;
pub use catalog::CompSpec;
pub use catalog::PropKind;
pub use catalog::PropSpec;
pub use catalog::lookup;
pub use catalog::suggest;
pub use diag::Diagnostic;
pub use guide::GUIDE;
pub use guide::guide_for;
pub use render::AssetResolver;
pub use render::BrandResolver;
pub use render::Cx;
pub use render::Fragment;
pub use render::Options;
pub use render::render;
pub use render::render_fragment;
pub use render::render_parts;
pub use render::script;
pub use render::stylesheet;

Modules§

asset
External images and SVG: byte lookup (never IO here), base64, MIME sniffing and the SVG sanitizer.
ast
Parsed .cv document. Every node is already validated against the catalog.
brand
@brand handling: parse keys, derive oklch accent scales, emit one @layer cascivo.theme block.
catalog
Component catalog types and lookup. Data lives in catalog_gen.
diag
Parser diagnostics.
emit
Component emitters. emit dispatches on the catalog name to a group module.
guide
Agent-facing usage guide. GUIDE is generated (see scripts/html-kit/gen-guide.ts); guide_for renders one component’s full detail from the catalog at call time.
html
Escaping and small writers shared by every emitter.
path
Path confinement shared by the CLI and cascivo-web: an author-supplied path may only name a file below its base directory.
render
Document assembly: parse → brand → emit → one self-contained HTML string.

Functions§

check
Parse-only validation: every diagnostic in src, empty when it is valid. Brand files need a resolver, so they are checked by render instead.
parse
Parses .cv source. On error, returns every diagnostic sorted by position.