Skip to main content

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 = "syntax-highlighting")]
34pub mod syntax;
35#[cfg(feature = "templating")]
36pub mod template;
37pub mod types;
38pub mod visibility;
39
40pub use appearance::{
41    ColorPalette, ContentWidth, FaviconAsset, FontFamily, ThemeAppearance, TypographySettings,
42};
43#[cfg(feature = "syntax-highlighting")]
44pub use body::render_body_with;
45pub use body::{preprocess_custom_syntax, render_body};
46pub use html::{
47    Generator, HtmlRenderer, ISLAND_CHILD_SCRIPT, ISLAND_CHILD_SCRIPT_FILENAME, PageContext,
48    SiteStyle,
49};
50pub use links::{percent_decode, root_prefix, transform_links};
51pub use nav::{build_site_nav_tree, forest_roots, nav_for_page};
52pub use shell::{ShellError, ShellSlots, ShellTemplate};
53#[cfg(feature = "syntax-highlighting")]
54pub use syntax::{CLASS_PREFIX, HIGHLIGHTED_CLASS, Syntaxes, highlight_code_blocks};
55pub use types::{Arrangement, Grain, Grouping, LinkEdge, OutlineNode, PageLayout, serve_at_dest};