Skip to main content

Crate plates_render

Crate plates_render 

Source
Expand description

The document-to-HTML half of plates: what a page looks like.

This crate reads nothing and resolves nothing. It is handed source text and a description of the site that text belongs to, and it gives back HTML — which is what lets one rendering run in a command-line build, in a sync server, and in an edge worker without three implementations quietly disagreeing about what a site looks like.

The plates crate is the layer above: it walks a prov::Workspace, decides which documents a site holds and where each one lands, and calls this.

A body’s grammar is its own — Markdown, Djot or HTML, read off the source document’s extension via prov::ContentFormat — and all three go through one parser, twig. See body for why that is the same parser the editor uses and what changed in the output when it stopped being comrak.

It must remain portable to wasm32-unknown-unknown, which is a constraint rather than a preference: no host functions, no filesystem, no entropy and no clock. A caller that has those reads the files and passes the bytes in.

Re-exports§

pub use appearance::ColorPalette;
pub use appearance::ContentWidth;
pub use appearance::FaviconAsset;
pub use appearance::FontFamily;
pub use appearance::ThemeAppearance;
pub use appearance::TypographySettings;
pub use body::preprocess_custom_syntax;
pub use body::render_body;
pub use headings::anchor_headings;
pub use headings::render_toc;
pub use html::Generator;
pub use html::HtmlRenderer;
pub use html::ISLAND_CHILD_SCRIPT;
pub use html::ISLAND_CHILD_SCRIPT_FILENAME;
pub use html::PageContext;
pub use html::SiteStyle;
pub use nav::build_site_nav_tree;
pub use nav::forest_roots;
pub use nav::nav_for_page;
pub use nav::neighbours;
pub use nav::reading_order;
pub use shell::ShellError;
pub use shell::ShellSlots;
pub use shell::ShellTemplate;
pub use types::Arrangement;
pub use types::FrameDoc;
pub use types::Heading;
pub use types::LinkEdge;
pub use types::OutlineNode;
pub use types::PageLayout;
pub use types::output_filename;
pub use types::serve_at_dest;

Modules§

appearance
Workspace appearance types: theme colors, typography, and favicon.
attachment
An attachment’s page: what a sidecar renders as.
body
Body prose → HTML, in whichever grammar the document is written in.
dates
Turning the dates a vault writes into the dates a feed reader will accept.
frontmatter
Reading the metadata block of a source document.
headings
Heading anchors and the page outline, as a pass over rendered HTML.
html
Full HTML document assembly: wraps rendered page bodies in the site shell (head, nav, breadcrumbs, footer, interactivity script) and produces the static CSS/favicon assets.
nav
Site navigation tree construction.
page
Page-shell helpers: navigation, breadcrumbs, SEO meta, feed/sitemap/robots generation, and small HTML/XML escaping utilities.
shell
The site shell as named slots, and the substitutor that fills a caller-supplied template with them.
types
Pure value types describing a site to be rendered.
visibility
Audience visibility filtering: which parts of a document leave.

Structs§

Grouping
What a grouped arrangement sorts entries into groups by.

Enums§

Grain
What a grouped arrangement sorts entries into groups by.

Functions§

percent_decode
Decode percent-encoded characters in a URL string (e.g. %20 ).
root_prefix
Compute the relative prefix to get from a page back to the site root.
transform_links
Rewrite internal .md hyperlinks in rendered HTML to their published .html destinations, resolving relative/workspace-root paths via the path_to_filename map. External links, anchors, and non-.md hrefs are left untouched.