Skip to main content

Crate docs_compiler

Crate docs_compiler 

Source
Expand description

docs-compiler: the composition CLI for the estate’s docs crates (docs-core extension program, SPEC.md M3/M4).

The pipeline is small and honest: scan a markdown document for the four directive kinds, resolve each one through the crate that owns it (include-symbol through docs-symbols, witness through docs-witness, lean-check through an out-of-process lean plus docs-proof, islands natively through docs-core), substitute the resulting raw HTML, and render the page with docs-core. Any failing directive fails the build with a typed error naming its source; nothing degrades to a silent placeholder.

use docs_compiler::BuildContext;

// No directives: the document flows through docs-core untouched.
let html = docs_compiler::compile(
    "# Title\n\nSome *prose*.\n",
    &BuildContext::new("."),
)
.unwrap();
assert!(html.contains("<h1>Title</h1>"));

§Layer

L3 - composition. Depends on docs-core (L2) and the capability crates (L0/L1); spawns lean as an external process (REQ-P1).

Structs§

BuildContext
The build context: directive file paths resolve against this root.
Directive
One resolved directive fence.
Scanned
A scanned source: raw markdown segments and directive fences, in document order.
SiteReport
What one site compilation pass produced.

Enums§

CompilerError
Why a build failed. Every directive failure names its source.
DirectiveKind
The three directive fences this compiler resolves. Island fences are not here: docs-core renders those natively.

Constants§

VERSION
The crate’s version, for callers that report it.

Functions§

compile
Compile one markdown document into a static HTML page.
compile_site
Compile every .md under src (recursive, hidden dirs skipped) into the mirrored .html layout under out. Directive roots are each page’s own directory, matching the single-file CLI’s default. One bad page never blocks the others: its error lands in the report.
mime_for
MIME type by extension; unknown extensions are plain text (the browser shows them instead of downloading).
resolve
Resolve one directive fence to a raw HTML block.
resolve_route
Map a request path to a file under out: empty → index.html; directories resolve to their index.html; an extensionless path falls back to <path>.html. Percent escapes are decoded; anything that escapes out (or games the encoding) resolves to nothing.
scan
Scan markdown for directive fences. Unrecognized fences (plain code, islands) are left as raw text for docs-core.