plates_render/lib.rs
1//! The document-to-HTML half of `plates`: what a page *looks like*.
2//!
3//! This crate reads nothing and resolves nothing. It is handed source text and
4//! a description of the site that text belongs to, and it gives back HTML —
5//! which is what lets one rendering run in a command-line build, in a sync
6//! server, and in an edge worker without three implementations quietly
7//! disagreeing about what a site looks like.
8//!
9//! The `plates` crate is the layer above: it walks a [`prov::Workspace`],
10//! decides which documents a site holds and where each one lands, and calls
11//! this.
12//!
13//! A body's grammar is its own — Markdown, Djot or HTML, read off the source
14//! document's extension via [`prov::ContentFormat`] — and all three go through
15//! one parser, `twig`. See [`body`] for why that is the same parser the editor
16//! uses and what changed in the output when it stopped being comrak.
17//!
18//! It must remain portable to `wasm32-unknown-unknown`, which is a constraint
19//! rather than a preference: no host functions, no filesystem, no entropy and
20//! no clock. A caller that has those reads the files and passes the bytes in.
21
22pub mod appearance;
23pub mod body;
24pub mod dates;
25pub mod frontmatter;
26pub mod html;
27mod links;
28pub mod nav;
29pub mod page;
30pub mod shell;
31#[cfg(feature = "templating")]
32pub mod site;
33#[cfg(feature = "templating")]
34pub mod template;
35pub mod types;
36pub mod visibility;
37
38pub use appearance::{
39 ColorPalette, ContentWidth, FaviconAsset, FontFamily, ThemeAppearance, TypographySettings,
40};
41pub use body::{preprocess_custom_syntax, render_body};
42pub use html::{
43 Generator, HtmlRenderer, ISLAND_CHILD_SCRIPT, ISLAND_CHILD_SCRIPT_FILENAME, PageContext,
44 SiteStyle,
45};
46pub use links::{percent_decode, root_prefix, transform_links};
47pub use nav::{build_site_nav_tree, nav_for_page};
48pub use shell::{ShellError, ShellSlots, ShellTemplate};
49pub use types::{Arrangement, Grain, Grouping, PageLayout, serve_at_dest};