Web

Web file generation by output format


Generates web documentation from Rust DSL sources. Each generator targets a specific output format and integrates with Bazel through Starlark rules for authoring, publishing, and serving.


HTML

Renders a Page element tree into complete HTML documents. Handles heading extraction for automatic table-of-contents generation, syntax-highlighted code blocks, and data injection for runtime assets.

Pages are authored as .page.rs content libraries using the Composition trait, which provides semantic methods for document structure:

fn main() -> miette::Result<()> { html::execute(|arguments| html::generate(arguments, function::page(&arguments.root))) }

Composition

The Composition trait adds high-level semantic methods to the body builder:

  • heading , title , subtitle , section — document structure
  • paragraph , aside , rule , term , definition — content blocks
  • navigation , figure — navigation
  • bold , link — inline formatting

Style

Generates CSS from a golden-ratio design system. All spacing, typography, and responsive breakpoints scale from PHI (1.618). Colors are defined as paired light/dark values, switchable via data-theme attribute.

  • Proportions : phi-scaled spacing variables from --scale-n2 to --scale-3
  • Typography : heading sizes follow the golden ratio scale
  • Layout : three-column grid (sidebar, main, outline) with responsive collapse
  • Themes : light and dark via CSS custom properties, persisted in localStorage

Highlight

Syntax highlighting dispatches to language-specific highlighters. Each produces HTML spans with semantic CSS classes for theme-aware coloring.

Language Strategy
Rust AST via syn, with snippet fallback
Molten Custom AST traversal
JSON Structural value coloring
Starlark Tree-sitter grammar
Bash Tree-sitter grammar

Assembly

Compiles Rust to WebAssembly for client-side interactivity. The assembly chain produces compute.js and compute_bg.wasm via rust_wasm_bindgen .

  • Navigate : SPA navigation without page reloads
  • Theme : toggle button with localStorage persistence
  • Clipboard : copy-to-clipboard on code blocks
  • Outline : scroll-tracking table of contents
  • Scroll : smooth scroll behavior
  • Hamburger : mobile sidebar toggle

Starlark

Bazel rules for authoring, publishing, verifying, and serving documentation. All rules are loaded from //component/web/starlark:defs.bzl .

document

Compiles a Rust DSL source into a binary, executes it, and collects the generated output. Standard dependencies ( html , miette ) are injected automatically.

document( src = "molten.document.rs", destination = "Molten/index.html", deps = ["//Molten/document:molten"], )
Parameter Description
src Rust binary source file (.document.rs)
destination Workspace-relative output path
deps Additional compile dependencies
data Runtime data files for WASM or code injection
compile_data Compile-time data files for include_str! sources

copy

Wraps an existing file with a destination path for inclusion in folder manifests. Uses a zero-cost symlink action.

copy( name = "favicon.copy", src = "favicon.ico", path = "resource/favicon.ico", )

folder

Aggregates document and copy targets into a manifest, then copies all generated files into the workspace.

folder( name = "documentation", srcs = [ ":domain", ":info.document", ":license.document", ":module.document", ":notice.document", ":vantle.document", "//:distribute.command.source", "//:distribute.rule.source", "//:folder.rule.source", "//:module.source.source", "//Molten:info.document", "//Molten:info.document.rule.source", "//Molten:license.document", "//Molten:molten.document", "//Molten:notice.document", "//Molten/resource:logo.copy", "//Molten/system/forge:command.lava.source", "//Molten/system/forge:command.lava.sink.grpc.source", "//Molten/system/forge:command.lava.sink.log.source", "//Molten/system/spatialize:command.spatialize.source", "//Molten/system/spatialize:launcher.assembler.source", "//Molten/system/spatialize:spatialize.document", "//Molten/system/spatialize/render/stage:geometry.pipeline.source", "//Molten/test/component/graph/state/particle:function.document.source", "//Molten/test/resource/system/graph/module/citizen/symbolic:citizen.source", "//Molten/test/resource/system/graph/module/join/symbolic:join.source", "//Molten/test/resource/system/graph/module/math/numeric/logic/boolean/symbolic:boolean.source", "//Molten/test/resource/system/graph/state/particle:particle.cases.json.source", "//Molten/test/resource/system/graph/state/particle:disjoint.source", "//Molten/test/resource/system/graph/state/particle:template.document.source", "//resource:copy.rule.source", "//resource:favicon.copy", "//resource:logo.copy", "//system/documentation:stylesheet.document", "//component/generation/starlark:extract.document.source", "//component/generation/starlark:query.document.source", "//system/generation:extract.document", "//system/generation:generation.document", "//system/generation/rust:autotest.document", "//system/generation/rust:function.document", "//system/generation/rust:function.document.extract.source", "//system/generation/rust:performance.document", "//system/generation/web:web.document", "//system/generation/web/assembly:compute.js.copy", "//system/generation/web/assembly:compute.wasm.copy", "//system/observation:observation.document", "//system/spatialize:spatialize.document", "//system/translator:view.trace.source", "//test/resource/system/performance/sort:sort.cases.json.source", "//test/resource/system/performance/sort:sort.document.source", "//test/resource/system/performance/sort:specification.json.source", "//test/system/function:execution.schema.source", "//test/system/performance/sort:execution.schema.source", "//test/system/performance/sort:performance.document.source", ], )

distribute

Serves the workspace directory over HTTP for local preview.

distribute( name = "distribute.documentation", folder = ":documentation", )