API Reference

This page documents the public API of the three library crates: taxus-domain (the model), taxus_lib (the generator library, crate taxus-generator) and taxus-common (islands and search). Terms are defined in the Glossary. cargo doc --workspace --no-deps --open builds the full rustdoc, which is the authoritative reference; this page is the map.

taxus-domain Crate

The pure data model. No I/O. See The Site Tree, Identity and Derivations.

identity Module

#![allow(unused)]
fn main() {
pub struct Slug(String);      // one validated URL segment
pub struct NodePath(Vec<Slug>); // slugs from the root to a node
pub struct UrlPath(String);   // the derived address, "/blog/my-post/"
pub enum IdentityError { Empty, Slash { s }, DotSegment { s }, ControlCharacter { s } }
}
ItemDescription
Slug::new(raw) -> Result<Slug, IdentityError>Validate a segment: non-empty, no /, not . or .., no control characters. Does not slugify
Slug::as_str(&self) -> &strThe segment
NodePath::root() -> NodePathThe root section's path (empty)
NodePath::parse(raw) -> Result<NodePath, IdentityError>From "blog/my-post"; "" and "/" are the root
NodePath::from_segments(iter) -> Result<NodePath, IdentityError>From slug strings
NodePath::is_root, parent, last, join(&Slug), segmentsPath queries
UrlPath::from_node_path(&NodePath) -> UrlPathThe one place addresses are derived: / for the root, else /a/b/
UrlPath::as_str(&self) -> &strThe address

schema Module

#![allow(unused)]
fn main() {
pub struct Frontmatter {
    pub title: String,                    // default ""
    pub description: Option<String>,
    pub tagline: Option<String>,
    pub date: Option<NaiveDate>,
    pub template: Option<String>,
    pub draft: bool,
    pub summary: Option<String>,
    pub slug: Option<String>,
    pub aliases: Vec<String>,
    pub tags: Vec<String>,
    pub categories: Vec<String>,
    pub series: Option<String>,
    pub extra: Option<toml::Value>,
    pub sort_by: SortBy,                  // default Date
    pub paginate_by: usize,               // 0 = no pagination
    pub paginate_template: Option<String>,
    pub weight: i32,
    pub pages_from: Vec<String>,          // donor sections, "blog"
    pub updated: Option<NaiveDate>,
    pub hero_image: Option<String>,
    pub hero_alt: Option<String>,
}

pub enum SortBy { Date, Title, Weight, None }
}
ItemDescription
Frontmatter::from_str(s) -> Result<Frontmatter, toml::de::Error>Parse TOML (via std::str::FromStr)
Frontmatter::template(&self) -> &strtemplate, or "page.html"
Frontmatter::extra_as_json(&self) -> HashMap<String, serde_json::Value>The [extra] table for templates

tree Module

#![allow(unused)]
fn main() {
pub struct SiteTree { pub root: SectionNode }

pub struct SectionNode {
    pub path: NodePath,
    pub content_file: Option<PathBuf>,   // "blog/_index.md", or None
    pub meta: Frontmatter,
    pub body: Option<String>,
    pub pages: Vec<PageNode>,            // direct children, by slug
    pub subsections: Vec<SectionNode>,   // direct children, by slug
}

pub struct PageNode {
    pub path: NodePath,
    pub content_file: PathBuf,           // "blog/2026-04-03-project-launch.md"
    pub meta: Frontmatter,
    pub body: String,
}

pub enum TreeError { Duplicate { path }, Collision { path, kind }, RootReserved, Identity(IdentityError) }
}
ItemDescription
SiteTree::get_section(&NodePath) -> Option<&SectionNode>Lookup by node path
SiteTree::get_page(&NodePath) -> Option<&PageNode>Lookup by node path
SiteTree::iter_pages(&self)Every page, depth-first, drafts included
PageNode::is_draft(&self) -> boolmeta.draft
SiteTreeBuilder::new() -> SiteTreeBuilderStart with a default root
SiteTreeBuilder::root(self, content_file, meta, body) -> SelfSet the root section's index file
SiteTreeBuilder::add_section(&mut self, &NodePath, content_file, meta, body) -> Result<(), TreeError>Declare a section at its final path
SiteTreeBuilder::add_page(&mut self, &NodePath, content_file, meta, body) -> Result<(), TreeError>Declare a page at its final path
SiteTreeBuilder::build(self) -> Result<SiteTree, TreeError>Assemble; auto-creates intermediate sections; sorts children by slug
sort_pages(&mut [&PageNode], SortBy)The ordering listings use: date newest first with undated last, title case-insensitive, weight lowest first, none

derivation Module

#![allow(unused)]
fn main() {
pub enum Node<'a> { Section(&'a SectionNode), Page(&'a PageNode) }
}
ItemDescription
Node::path, meta, content_file, is_section, is_draftAccessors shared by both kinds
documents(&SiteTree) -> Vec<Node>Every document in tree order; drafts included
descendant_pages(&SectionNode) -> Vec<&PageNode>Every page below a section, depth-first
recent(&SiteTree, include_drafts) -> Vec<&PageNode>All pages, newest first, undated last
aggregate(&SectionNode, &SiteTree, &[NodePath]) -> Vec<&PageNode>The receiver's pages plus each donor's direct pages, deduplicated, unsorted
group_by_terms(&SiteTree, include_drafts, terms_of) -> BTreeMap<String, Vec<Node>>Documents grouped by the terms a selector reads from frontmatter

The crate root re-exports Frontmatter, SortBy, NodePath, Slug, UrlPath, PageNode, SectionNode, SiteTree, SiteTreeBuilder and TreeError.


taxus-common Crate

Shared by the generator (build-time rendering) and the client (browser hydration).

components Module

ComponentPropsDescription
counter::CounterCounterProps { initial: i32, class: String }Demonstration counter
search_box::SearchBoxSearchBoxProps { placeholder: String, max_results: usize, class: String }Client-side search input; see Search

search Module

SearchDocument

#![allow(unused)]
fn main() {
pub struct SearchDocument {
    pub id: u32,
    pub title: String,
    pub path: String,
    pub summary: String,
    pub tags: Vec<String>,
    pub categories: Vec<String>,
}
}
MethodDescription
new(id, title, path, summary, tags, categories) -> SelfCreate a new document

SearchIndex

#![allow(unused)]
fn main() {
pub struct SearchIndex {
    pub documents: BTreeMap<u32, SearchDocument>,
    pub index: HashMap<String, Vec<(u32, f32)>>,
}
}
MethodDescription
new() -> SelfCreate empty index
add_document(&mut self, doc: SearchDocument, content: &str)Add a document with its content for indexing
search(&self, query: &str) -> Vec<&SearchDocument>Search and return ranked results
finalize(&mut self)Apply IDF weighting (call after all documents added)
to_bytes(&self) -> Result<Vec<u8>, postcard::Error>Serialize to binary (postcard format)
from_bytes(bytes: &[u8]) -> Result<Self, postcard::Error>Deserialize from binary

Helper Functions

#![allow(unused)]
fn main() {
pub fn tokenize(text: &str) -> Vec<String>  // lowercase tokens, words shorter than 3 characters dropped
pub fn stem(tokens: &[String]) -> Vec<String> // English Porter stemmer
}

taxus-generator Crate (taxus_lib)

Re-exports

#![allow(unused)]
fn main() {
pub use config::{BuildConfig, ImageConfig, SiteConfig, SiteMeta};
pub use content::{ContentSource, FilesystemContentSource, Frontmatter, Page};
pub use templates::{HeroContext, PageContext, SectionContext, SiteContext, TemplateContext, TemplateRenderer, TeraRenderer};
pub use assets::{AssetProcessor, AssetReport, ScssProcessor, StaticCopier};
pub use build::{BuildReport, SiteBuilder};
pub use feed::{FeedConfig, FeedEntry, FeedGenerator};
pub use highlighting::{CodeHighlighter, LanguageRegistry};
pub use images::{ImageProcessor, ImageRegistry, ProcessedImage, render_picture};
pub use init::{InitOptions, InitReport, InitScaffolder};
pub use routes::{RouteDiscovery, RouteInfo, RouteKind, RouteRegistry};
pub use error::{AssetError, ContentError, FeedError, GeneratorError, ImageError, InitError, Result, RouteError, TemplateError};
}

config Module

SiteConfig

#![allow(unused)]
fn main() {
pub struct SiteConfig {
    pub site: SiteMeta,
    pub build: BuildConfig,
    pub feed: FeedConfig,
    pub highlight: HighlightConfig,
    pub images: ImageConfig,
    pub markdown: MarkdownConfig,
    pub base_dir: PathBuf,
}
}
MethodDescription
from_file(path: P) -> Result<Self>Load from file
from_dir(dir: P) -> Result<Self>Load from directory (looks for site.toml)
new(name, base_url) -> SelfCreate programmatically
validate(&self) -> Result<()>Validate site.name, site.base_url, images.quality, images.format

SiteMeta

#![allow(unused)]
fn main() {
pub struct SiteMeta {
    pub name: String,
    pub base_url: String,
    pub description: Option<String>,
    pub author: Option<String>,
}
}

BuildConfig

#![allow(unused)]
fn main() {
pub struct BuildConfig {
    pub content_dir: PathBuf,    // default: "content"
    pub output_dir: PathBuf,     // default: "dist"
    pub static_dir: PathBuf,     // default: "static"
    pub styles_dir: PathBuf,     // default: "styles"
    pub templates_dir: PathBuf,  // default: "templates"
}
}
MethodDescription
resolve_paths(&mut self, base_dir: &Path)Make relative directories absolute against the site directory

FeedConfig

#![allow(unused)]
fn main() {
pub struct FeedConfig {
    pub rss_enabled: bool,       // default: true
    pub atom_enabled: bool,      // default: false
    pub limit: usize,            // default: 20 (0 is treated as 20)
    pub full_content: bool,      // default: false
    pub title: Option<String>,
    pub rss_path: Option<String>,   // default file: feed.xml
    pub atom_path: Option<String>,  // default file: feed.atom
    pub sections: Vec<String>,   // default: [] (whole site)
}
}

HighlightConfig, ImageConfig, MarkdownConfig

#![allow(unused)]
fn main() {
pub struct HighlightConfig { pub enabled: bool /* true */, pub class_prefix: String /* "hl-" */ }
pub struct ImageConfig { pub widths: Vec<u32>, pub quality: u8, pub format: String, pub output_dir: PathBuf }
pub struct MarkdownConfig { pub insert_anchor_links: bool }
}
MethodDescription
ImageConfig::normalize(&mut self)"jpg" becomes "jpeg"
ImageConfig::validate(&self) -> Result<()>Quality 1..=100; format webp, jpeg, jpg or png

content Module

Frontmatter and SortBy are re-exported from taxus-domain.

Page

One parsed content file (page or index file).

#![allow(unused)]
fn main() {
pub struct Page {
    pub frontmatter: Frontmatter, // page metadata
    pub raw_content: String,      // the Markdown body
}
}

A Page is the parsed form of one tree node's document — exactly what discovery read from disk, nothing computed. The build constructs them from the tree in stage 3; the served URL lives on ProcessedPage, never here.

MethodDescription
from_file(path: P) -> Result<Self>Load from a Markdown file
from_str(content: &str, source: &str) -> Result<Self>Parse from string (what discovery uses)
template(&self) -> &strtemplate, or "page.html"
is_draft(&self) -> boolCheck if draft
summary(&self) -> StringFrontmatter summary, else text before <!-- more -->, else first paragraph
word_count(&self) -> usize, reading_time(&self) -> usizeFrom the body; 200 words per minute, rounded up
aliases, tags, categories, seriesFrontmatter accessors

split_date_prefix

#![allow(unused)]
fn main() {
pub fn split_date_prefix(stem: &str) -> (&str, Option<NaiveDate>)
}

Strips a valid YYYY-MM-DD- prefix from a file stem and returns the date; a stem that is only a date is returned unchanged.

Sections

Sections are not a content type. A directory is a taxus_domain::SectionNode in the SiteTree built by RouteDiscovery::discover_tree; see The Site Tree.

TaxonomyKind, TaxonomyTerm, TaxonomyMap

#![allow(unused)]
fn main() {
pub enum TaxonomyKind { Tag, Category, Series }
pub struct TaxonomyTerm { pub kind, pub name: String, pub slug: String, pub page_count: usize, pub page_paths: Vec<String> /* content files */ }
pub struct TaxonomyMap { /* terms per kind */ }
}
MethodDescription
TaxonomyKind::path_prefix(&self) -> &str"tags", "categories", "series"
TaxonomyKind::plural_name(&self) -> &str"Tags", "Categories", "Series"
TaxonomyTerm::url_path(&self) -> String/tags/rust/
TaxonomyMap::add_term(&mut self, kind, name, content_file)File a document under a term
TaxonomyMap::tags(), categories(), series()Terms of a kind, sorted by name
TaxonomyMap::get_tag(slug), get_category(slug), get_series(slug)Lookup by term slug

ContentSource Trait

#![allow(unused)]
fn main() {
pub trait ContentSource: Send + Sync {
    fn load(&self, path: &Path) -> Result<String>;
    fn exists(&self, path: &Path) -> bool;
    fn list(&self) -> Result<Vec<PathBuf>>;
}
}

FilesystemContentSource

MethodDescription
new(root: P) -> SelfCreate with root directory

routes Module

RouteKind

#![allow(unused)]
fn main() {
pub enum RouteKind { Page, Section }
}

RouteInfo

#![allow(unused)]
fn main() {
pub struct RouteInfo {
    pub path: String,          // URL path, "/blog/my-post/"
    pub content_file: PathBuf,
    pub output_file: PathBuf,  // "blog/my-post/index.html"
    pub kind: RouteKind,
}
}

RouteRegistry

MethodDescription
new() -> SelfCreate empty registry
from_tree(tree: &SiteTree) -> SelfDerive the registry from a Site Tree (one route per document, in tree order)
register(&mut self, route: RouteInfo)Register a route
get(&self, path: &str) -> Option<&RouteInfo>Get by URL path
contains(&self, path: &str) -> boolCheck existence
len(&self) -> usize, is_empty(&self) -> boolCount routes
iter(&self), pages(&self), sections(&self)Iterate in registration order
find_by_content_file(&self, &Path) -> Option<&RouteInfo>Lookup by content file

RouteDiscovery

MethodDescription
new(content_dir: P) -> SelfCreate with content directory
discover_tree(&self) -> Result<SiteTree>Walk the content directory and build the Site Tree (what SiteBuilder::build uses)
discover_tree_from_source(&self, source: &impl ContentSource) -> Result<SiteTree>Same, from a ContentSource
discover(&self) -> Result<RouteRegistry, RouteError>Legacy file walk: routes keyed by filename, frontmatter not read
discover_from_source(&self, source: &impl ContentSource) -> Result<RouteRegistry, RouteError>Legacy walk from a ContentSource

slugify

#![allow(unused)]
fn main() {
pub fn slugify_segment(segment: &str) -> String  // "My Créative Post" -> "my-creative-post" (node paths; ASCII)
pub fn slugify_path(relative: &str) -> String    // "blog/My Old Post" -> "blog/my-old-post"
pub fn slugify_term(name: &str) -> String        // "Café" -> "café" (taxonomy terms; keeps non-ASCII letters)
}

templates Module

TemplateRenderer Trait

#![allow(unused)]
fn main() {
pub trait TemplateRenderer: Send + Sync {
    fn render(&self, template: &str, context: &TemplateContext) -> Result<String, TemplateError>;
    fn register_template(&mut self, name: &str, content: &str) -> Result<(), TemplateError>;
    fn has_template(&self, name: &str) -> bool;
    fn load_templates(&mut self, dir: &Path) -> Result<(), TemplateError>;
}
}

TeraRenderer

MethodDescription
new() -> Result<Self, TemplateError>Empty renderer with island(), get_section(), get_page(), slugify, term_slug, slug and date registered
from_dir(dir: P) -> Result<Self, TemplateError>Create and load **/*.html from a directory
set_site_lookup(&self, sections, pages)What get_section and get_page resolve to; the render stage fills it

TemplateContext

#![allow(unused)]
fn main() {
pub struct TemplateContext {
    pub page: Option<PageContext>,
    pub section: Option<SectionContext>,
    pub site: SiteContext,
    pub now: NowContext,
    pub extra: HashMap<String, serde_json::Value>,
}
}
MethodDescription
new(site: SiteContext) -> SelfCreate with site
with_page(self, page: PageContext) -> SelfAdd page
with_section(self, section: SectionContext) -> SelfAdd section
with_extra(self, extra: HashMap) -> SelfAdd extra

PageContext

#![allow(unused)]
fn main() {
pub struct PageContext {
    pub title: String,
    pub description: Option<String>,
    pub tagline: Option<String>,
    pub path: String,             // URL path
    pub permalink: String,        // base_url + path
    pub content: String,          // rendered HTML
    pub raw_content: String,
    pub date: Option<String>,     // ISO 8601
    pub draft: bool,
    pub summary: String,
    pub word_count: usize,
    pub reading_time: usize,
    pub toc: Vec<TocEntry>,
    pub tags: Vec<String>,
    pub categories: Vec<String>,
    pub series: Option<String>,
    pub weight: i32,
    pub hero: Option<HeroContext>,
}
}

HeroContext

#![allow(unused)]
fn main() {
pub struct HeroContext { pub src: String, pub srcset: String, pub width: u32, pub height: u32, pub alt: String, pub mime_type: String }
}

SectionContext and SubsectionContext

#![allow(unused)]
fn main() {
pub struct SectionContext {
    pub title: String,
    pub description: Option<String>,
    pub path: String,
    pub permalink: String,
    pub content: Option<String>,
    pub toc: Vec<TocEntry>,
    pub pages: Vec<PageContext>,          // the listing
    pub pagination: Option<PaginationContext>,
    pub subsections: Vec<SubsectionContext>,
}

pub struct SubsectionContext { pub title: String, pub description: Option<String>, pub path: String, pub permalink: String }
}

PaginationContext

#![allow(unused)]
fn main() {
pub struct PaginationContext {
    pub current: usize,
    pub total: usize,
    pub per_page: usize,
    pub total_items: usize,
    pub prev: Option<String>,
    pub next: Option<String>,
    pub first: String,
    pub last: String,
}
}
MethodDescription
is_first(&self), is_last(&self)Position checks
page_range(&self) -> Vec<Option<usize>>Page numbers for navigation, None for gaps

TaxonomyListContext and TaxonomyTermContext

#![allow(unused)]
fn main() {
pub struct TaxonomyListContext { pub kind: String, pub path: String, pub terms: Vec<TaxonomyTermContext> }
pub struct TaxonomyTermContext { pub kind: String, pub name: String, pub slug: String, pub path: String, pub page_count: usize, pub pages: Vec<PageContext> }
}

Both are passed to templates as extra.taxonomy.

SiteContext and NowContext

#![allow(unused)]
fn main() {
pub struct SiteContext { pub name: String, pub base_url: String, pub description: Option<String>, pub author: Option<String> }
pub struct NowContext { pub year: i32 }
}
#![allow(unused)]
fn main() {
pub fn compute_permalink(base_url: &str, path: &str) -> String
}

build Module

SiteBuilder

MethodDescription
from_dir(dir: &Path) -> Result<Self>Create from directory
new(config: SiteConfig) -> SelfCreate from config
dry_run(self, bool) -> SelfSet dry-run mode
verbose(self, bool) -> SelfNo-op kept for API compatibility; verbosity is tracing debug level (#54)
include_drafts(self, bool) -> SelfInclude drafts
output_dir(self, dir: impl Into<PathBuf>) -> SelfOverride the output directory
build(self) -> Result<BuildReport>Run the fifteen-stage pipeline (see Architecture)
clean(self) -> Result<()>Clean output directory
config(&self) -> &SiteConfigThe configuration

BuildReport

#![allow(unused)]
fn main() {
pub struct BuildReport {
    pub pages_rendered: usize,
    pub sections_rendered: usize,
    pub drafts_skipped: usize,
    pub sitemap_urls: usize,
    pub assets: AssetReport,
    pub duration: Duration,
    pub warnings: Vec<String>,
    pub output_dir: PathBuf,
}
}
MethodDescription
print_summary(&self)Print summary
total_files(&self) -> usizePages plus sections plus assets
has_warnings(&self), has_errors(&self), is_failure(&self)Status checks
add_warning(&mut self, warning)Record a warning

ProcessedPage and RenderedPage

#![allow(unused)]
fn main() {
pub struct ProcessedPage {
    pub route: RouteInfo,
    pub page: Page,
    pub html_content: String,
    pub toc: Vec<TocEntry>,
    pub hero_image: Option<ProcessedImage>,
}

pub struct RenderedPage {
    pub route: RouteInfo,
    pub content: String,
    pub hero_image: Option<ProcessedImage>,
}
}
MethodDescription
ProcessedPage::effective_url_path(&self) -> StringThe served URL path (the route's path, derived from the tree)
ProcessedImage::fallback_src(&self) -> Option<String>The middle variant's URL — None only for hand-built images with no variants (#51)

build::pipeline functions

FunctionStageDescription
load_config(dir) -> Result<SiteConfig>setupLoad site.toml
discover_tree(&SiteConfig) -> Result<SiteTree>1Build the Site Tree
discover_routes(&SiteConfig) -> Result<RouteRegistry>1The tree projected to routes
load_templates(&SiteConfig) -> Result<TeraRenderer>2Load templates
process_content(&SiteTree, &RouteRegistry, &SiteConfig, include_drafts, highlighter) -> Result<(Vec<ProcessedPage>, usize)>3Render Markdown from the tree; returns the pages and the observed skip count (#55)
process_images(&mut [ProcessedPage], &SiteConfig, dry_run) -> Result<ImageRegistry>4Hero image variants
copy_colocated_assets(content_dir, output_dir, dry_run) -> Result<AssetReport>5Copy non-.md files
pages::render_pages(&[ProcessedPage], &SiteTree, &TeraRenderer, &SiteContext) -> Result<Vec<RenderedPage>>6Run templates
robots::generate_robots, write_robots7robots.txt
not_found::generate_404, write_4048404.html
taxonomy::build_taxonomy_map(&SiteTree), render_taxonomy_pages, write_taxonomy_pages9Taxonomy pages
sitemap::generate_sitemap(&[RenderedPage], &[RenderedTaxonomy], &[ProcessedPage], &SiteConfig), write_sitemap10sitemap.xml from final outputs
feeds::feed_pages(&SiteTree, &[String]), generate_feeds, write_feeds11Feeds
process_assets(&SiteConfig, output_dir, dry_run) -> Result<AssetReport>12SCSS and static files
search::generate_search(&[ProcessedPage]) -> Result<GeneratedSearch>, write_search_index13search_index.bin
wasm::build_wasm_client(output_dir, dry_run) -> Result<WasmBuildOutput>14Write dist/wasm/
write_output(&[RenderedPage], output_dir, dry_run), alias::write_aliases15Write files
clean_output(output_dir)Remove the output directory
markdown::markdown_to_html_with_toc(markdown, highlighter, &MarkdownOptions) -> (String, Vec<TocEntry>)3Markdown rendering
internal_links::resolve_internal_links(content, source_file, &RouteRegistry)3@/ links
render_island_counter(CounterProps), render_search_box(SearchBoxProps)6Island SSR helpers

assets Module

AssetProcessor Trait

#![allow(unused)]
fn main() {
pub trait AssetProcessor: Send + Sync {
    fn process(&self, src: &Path, dest: &Path, dry_run: bool) -> Result<AssetReport, AssetError>;
    fn handles(&self, path: &Path) -> bool;
    fn name(&self) -> &'static str;
}
}

ScssProcessor

MethodDescription
new() -> SelfCreate with defaults
with_include_paths(paths: Vec<P>) -> SelfSet include paths
with_minify(self, bool) -> SelfSet minify

StaticCopier

MethodDescription
new() -> SelfCreate with defaults
with_exclusions(patterns: Vec<String>) -> SelfSet exclusions

AssetReport

#![allow(unused)]
fn main() {
pub struct AssetReport {
    pub files_processed: usize,
    pub files_skipped: usize,
    pub errors: Vec<String>,
}
}
MethodDescription
merge(&mut self, other: AssetReport)Merge reports
has_errors(&self) -> bool, total_files(&self) -> usizeStatus

images Module

ItemDescription
ImageProcessor::new(ImageConfig, output_dir)Create a processor
ImageProcessor::process(&self, source, alt) -> Result<ProcessedImage>Generate variants (cached by content hash and quality)
ImageProcessor::process_dry(&self, source, alt) -> Result<ProcessedImage>Paths only, no pixel work
ImageProcessor::quality_ignored_for_webp(&self) -> boolTrue when built without webp-lossy and the format is WebP
ProcessedImage::srcset, fallback_src, mime_type, url_path(&ImageVariant)What HeroContext is built from
ImageRegistryProcessed images keyed by source path
render_picture(&ProcessedImage, alt, loading) -> StringA <picture> element
LOSSY_WEBP_AVAILABLE: boolWhether the webp-lossy feature is compiled in

highlighting Module

ItemDescription
LanguageRegistry::new(), get(name), iter()Registered tree-sitter grammars (rust, alias rs)
CodeHighlighter::new(LanguageRegistry, class_prefix)Create a highlighter
CodeHighlighter::highlight(&mut self, code, language) -> HighlightResultHighlight one block; unknown languages are escaped plain text

feed Module

#![allow(unused)]
fn main() {
pub struct FeedConfig { pub title, pub description, pub base_url, pub author, pub author_email, pub language, pub limit: Option<usize>, pub full_content, pub filename }
pub struct FeedEntry { pub title, pub url, pub summary, pub content: Option<String>, pub date: DateTime<Utc>, pub updated, pub author, pub author_email, pub tags }
}
ItemDescription
FeedEntry::from_page(&Page, url) -> FeedEntrySummary is summary, else description, else Page::summary(); url is the served (effective) URL, supplied by the caller
FeedGenerator::new(FeedConfig)Create a generator
FeedGenerator::generate_rss(&[Page]), generate_atom(&[Page])Drafts dropped, newest first, truncated to limit; URLs derive from page.path, so prefer the _from_entries forms for pages with custom slugs
FeedGenerator::generate_rss_from_entries(Vec<FeedEntry>), generate_atom_from_entries(Vec<FeedEntry>)The pipeline form: entries carry their own effective URLs; newest first, truncated to limit
FeedGenerator::rss_filename(), atom_filename()feed.xml, feed.atom
escape_xml(&str) -> StringXML escaping

init Module

InitOptions

#![allow(unused)]
fn main() {
pub struct InitOptions {
    pub name: String,
    pub base_url: String,
    pub force: bool,
    pub islands: bool,
}
}
MethodDescription
new(name, base_url) -> SelfCreate options
with_force(self, bool) -> SelfSet force
with_islands(self, bool) -> Self, without_islands(self) -> SelfIslands on or off
validate(&self) -> Result<(), InitError>Non-empty name; base URL starts with http:// or https://

InitScaffolder

MethodDescription
new(options: InitOptions) -> SelfCreate scaffolder
scaffold(&self, path: &Path) -> Result<InitReport>Scaffold site

InitReport

#![allow(unused)]
fn main() {
pub struct InitReport {
    pub path: PathBuf,
    pub directories_created: usize,
    pub files_created: usize,
    pub created_dirs: Vec<PathBuf>,
    pub created_files: Vec<PathBuf>,
}
}

Helpers

#![allow(unused)]
fn main() {
pub fn is_directory_empty(path: &Path) -> Result<bool>
pub fn derive_site_name(path: &Path) -> String
}

serve Module

DevServer

MethodDescription
new(config: DevServerConfig, rebuild: RebuildFn) -> SelfCreate server; RebuildFn is Arc<dyn Fn() -> Result<(), String> + Send + Sync>
run(&self) -> Result<()>Start server (async)
host(&self) -> IpAddr, port(&self) -> u16Bind address

DevServerConfig

#![allow(unused)]
fn main() {
pub struct DevServerConfig {
    pub host: IpAddr,            // default: 127.0.0.1
    pub port: u16,               // default: 3000
    pub output_dir: PathBuf,
    pub site_dir: PathBuf,
    // ...
}
}
MethodDescription
default() -> SelfCreate with defaults
with_host(self, host: IpAddr) -> SelfSet bind address
with_port(self, port: u16) -> SelfSet port
with_output_dir(self, dir: PathBuf) -> SelfSet output dir
with_site_dir(self, dir: PathBuf) -> SelfSet site dir
with_include_drafts(self, bool) -> SelfMirrored into every rebuild (#40)
with_open(self, bool) -> SelfOpen a browser after starting

Also exported: browsable_url(SocketAddr) -> String, FileWatcher, WatchEvent, ChangeType, ReloadEvent, WebSocketMessage, inject_live_reload_script, LIVE_RELOAD_SCRIPT.

error Module

GeneratorError

#![allow(unused)]
fn main() {
pub enum GeneratorError {
    Config(Box<ConfigError>),
    Content(Box<ContentError>),
    Template(Box<TemplateError>),
    Asset(Box<AssetError>),
    Route(Box<RouteError>),
    Init(Box<InitError>),
    Serve(Box<ServeError>),
    Feed(Box<FeedError>),
    Image(Box<ImageError>),
    Search(Box<SearchError>),
    Io { path: PathBuf, source: std::io::Error },
    NoContent,
    BrokenInternalLink { file: String, target: String },
    PageRenderFailed { path: String, source: TemplateError },
}
}
TypeDescription
ConfigErrorConfiguration errors (not found, parse, missing field, invalid value)
ContentErrorContent errors (not found, frontmatter, IO)
TemplateErrorTemplate errors (not found, render, syntax)
AssetErrorAsset errors (SCSS, copy)
RouteErrorRoute errors (not found, duplicate, invalid path, discovery failed)
FeedErrorFeed generation errors
ImageErrorImage processing errors
InitErrorInitialization errors (invalid name or URL, file write, cancelled)
ServeErrorServer errors (port in use, WebSocket)
SearchErrorSearch index serialization errors
WasmErrorWASM client write errors (not wrapped by GeneratorError)

Result

#![allow(unused)]
fn main() {
pub type Result<T> = std::result::Result<T, GeneratorError>;
}

telemetry Module

FunctionDescription
init()Initialize with RUST_LOG env var
init_tracing(verbose: bool, quiet: bool)Initialize from CLI flags, falling back to RUST_LOG
init_with_level(level: &str)Initialize with specific level