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:disjoint.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/rust:visualize.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",
"//Molten/test/component/graph/state/particle:particle.component.document.template.source",
"//Molten/test/component/graph/state/particle:particle.component.document.cases.source",
"//Molten/test/component/graph/state/particle:particle.component.document.execution.source",
"//Molten/test/component/graph/state/wave:wave.component.document.template.source",
"//Molten/test/component/graph/state/wave:wave.component.document.cases.source",
"//Molten/test/component/graph/state/wave:wave.component.document.execution.source",
"//Molten/test/component/graph/relation:relation.component.document.template.source",
"//Molten/test/component/graph/relation:relation.component.document.cases.source",
"//Molten/test/component/graph/relation:relation.component.document.execution.source",
"//Molten/test/component/graph/attribute:attribute.component.document.template.source",
"//Molten/test/component/graph/attribute:attribute.component.document.cases.source",
"//Molten/test/component/graph/attribute:attribute.component.document.execution.source",
"//Molten/test/component/graph/symbolic/constructor/syntax:syntax.document.template.source",
"//Molten/test/component/graph/symbolic/constructor/syntax:syntax.document.cases.source",
"//Molten/test/component/graph/symbolic/constructor/syntax:syntax.document.execution.source",
"//Molten/test/component/graph/symbolic/translator:translator.component.document.template.source",
"//Molten/test/component/graph/symbolic/translator:translator.component.document.cases.source",
"//Molten/test/component/graph/symbolic/translator:translator.component.document.execution.source",
"//Molten/test/system/observation:snapshot.document.template.source",
"//Molten/test/system/observation:snapshot.document.cases.source",
"//Molten/test/system/observation:snapshot.document.execution.source",
"//Molten/test/system/query:query.document.template.source",
"//Molten/test/system/query:query.document.cases.source",
"//Molten/test/system/query:query.document.execution.source",
"//Molten/test/system/arena:arena.system.document.template.source",
"//Molten/test/system/arena:arena.system.document.cases.source",
"//Molten/test/system/arena:arena.system.document.execution.source",
"//Molten/test/system/arena:arena.observation.document.template.source",
"//Molten/test/system/arena:arena.observation.document.cases.source",
"//Molten/test/system/arena:arena.observation.document.execution.source",
"//Molten/test/system/graph:graph.document.template.source",
"//Molten/test/system/graph:graph.document.cases.source",
"//Molten/test/system/graph:graph.document.execution.source",
"//Molten/test/system/graph/constructor:constructor.document.template.source",
"//Molten/test/system/graph/constructor:constructor.document.cases.source",
"//Molten/test/system/graph/constructor:constructor.document.execution.source",
"//Molten/test/system/graph/relation:relation.system.document.template.source",
"//Molten/test/system/graph/relation:relation.system.document.cases.source",
"//Molten/test/system/graph/relation:relation.system.document.execution.source",
"//Molten/test/system/graph/index:index.document.template.source",
"//Molten/test/system/graph/index:index.document.cases.source",
"//Molten/test/system/graph/index:index.document.execution.source",
"//Molten/test/system/graph/attribute/breadth:breadth.document.template.source",
"//Molten/test/system/graph/attribute/breadth:breadth.document.cases.source",
"//Molten/test/system/graph/attribute/breadth:breadth.document.execution.source",
"//Molten/test/system/graph/state:particle.state.document.template.source",
"//Molten/test/system/graph/state:particle.state.document.cases.source",
"//Molten/test/system/graph/state:particle.state.document.execution.source",
"//Molten/test/system/graph/state:wave.state.document.template.source",
"//Molten/test/system/graph/state:wave.state.document.cases.source",
"//Molten/test/system/graph/state:wave.state.document.execution.source",
"//Molten/test/system/graph/symbolic:translator.symbolic.document.template.source",
"//Molten/test/system/graph/symbolic:translator.symbolic.document.cases.source",
"//Molten/test/system/graph/symbolic:translator.symbolic.document.execution.source",
"//Molten/test/system/graph/symbolic:renderer.document.template.source",
"//Molten/test/system/graph/symbolic:renderer.document.cases.source",
"//Molten/test/system/graph/symbolic:renderer.document.execution.source",
"//Molten/test/system/graph/symbolic/arena:arena.symbolic.document.template.source",
"//Molten/test/system/graph/symbolic/arena:arena.symbolic.document.cases.source",
"//Molten/test/system/graph/symbolic/arena:arena.symbolic.document.execution.source",
"//Molten/test/system/graph/symbolic/partition:partition.document.template.source",
"//Molten/test/system/graph/symbolic/partition:partition.document.cases.source",
"//Molten/test/system/graph/symbolic/partition:partition.document.execution.source",
"//Molten/test/system/graph/symbolic/group:group.document.template.source",
"//Molten/test/system/graph/symbolic/group:group.document.cases.source",
"//Molten/test/system/graph/symbolic/group:group.document.execution.source",
"//Molten/test/system/graph/symbolic/context:context.document.template.source",
"//Molten/test/system/graph/symbolic/context:context.document.cases.source",
"//Molten/test/system/graph/symbolic/context:context.document.execution.source",
"//Molten/test/system/graph/symbolic/module:module.document.template.source",
"//Molten/test/system/graph/symbolic/module:module.document.cases.source",
"//Molten/test/system/graph/symbolic/module:module.document.execution.source",
"//Molten/test/system/graph/symbolic/attribute:attribute.symbolic.document.template.source",
"//Molten/test/system/graph/symbolic/attribute:attribute.symbolic.document.cases.source",
"//Molten/test/system/graph/symbolic/attribute:attribute.symbolic.document.execution.source",
"//Molten/test/system/graph/symbolic/traversal:traversal.document.template.source",
"//Molten/test/system/graph/symbolic/traversal:traversal.document.cases.source",
"//Molten/test/system/graph/symbolic/traversal:traversal.document.execution.source",
"//Molten/test/system/hypergraph/evaluate:evaluate.document.template.source",
"//Molten/test/system/hypergraph/evaluate:evaluate.document.cases.source",
"//Molten/test/system/hypergraph/evaluate:evaluate.document.execution.source",
"//Molten/test/system/hypergraph/evaluate:evaluate.observation.document.template.source",
"//Molten/test/system/hypergraph/evaluate:evaluate.observation.document.cases.source",
"//Molten/test/system/hypergraph/evaluate:evaluate.observation.document.execution.source",
"//Molten/test/system/translate:translate.document.template.source",
"//Molten/test/system/translate:translate.document.cases.source",
"//Molten/test/system/translate:translate.document.execution.source",
"//Molten/test/system/scale:scale.document.template.source",
"//Molten/test/system/scale:scale.document.cases.source",
"//Molten/test/system/scale:scale.document.execution.source",
"//test/component/observation:observation.document.template.source",
"//test/component/observation:observation.document.cases.source",
"//test/component/observation:observation.document.execution.source",
"//test/component/observation:lifecycle.document.template.source",
"//test/component/observation:lifecycle.document.cases.source",
"//test/component/observation:lifecycle.document.execution.source",
"//test/component/observation:channel.document.template.source",
"//test/component/observation:channel.document.cases.source",
"//test/component/observation:channel.document.execution.source",
"//test/component/observation:expression.observation.document.template.source",
"//test/component/observation:expression.observation.document.cases.source",
"//test/component/observation:expression.observation.document.execution.source",
"//test/component/math/expression:expression.math.document.template.source",
"//test/component/math/expression:expression.math.document.cases.source",
"//test/component/math/expression:expression.math.document.execution.source",
"//test/component/spatialize/vector:vector.document.template.source",
"//test/component/spatialize/vector:vector.document.cases.source",
"//test/component/spatialize/vector:vector.document.execution.source",
"//test/component/spatialize/quaternion:quaternion.document.template.source",
"//test/component/spatialize/quaternion:quaternion.document.cases.source",
"//test/component/spatialize/quaternion:quaternion.document.execution.source",
"//test/component/spatialize/color:color.document.template.source",
"//test/component/spatialize/color:color.document.cases.source",
"//test/component/spatialize/color:color.document.execution.source",
"//test/component/design/proportion:proportion.document.template.source",
"//test/component/design/proportion:proportion.document.cases.source",
"//test/component/design/proportion:proportion.document.execution.source",
"//test/component/web/render:render.document.template.source",
"//test/component/web/render:render.document.cases.source",
"//test/component/web/render:render.document.execution.source",
"//test/system/observation:level.document.template.source",
"//test/system/observation:level.document.cases.source",
"//test/system/observation:level.document.execution.source",
"//test/system/observation:span.document.template.source",
"//test/system/observation:span.document.cases.source",
"//test/system/observation:span.document.execution.source",
"//test/system/observation:hierarchy.document.template.source",
"//test/system/observation:hierarchy.document.cases.source",
"//test/system/observation:hierarchy.document.execution.source",
"//test/system/observation:filtering.document.template.source",
"//test/system/observation:filtering.document.cases.source",
"//test/system/observation:filtering.document.execution.source",
"//test/system/observation:peer.document.template.source",
"//test/system/observation:peer.document.cases.source",
"//test/system/observation:peer.document.execution.source",
"//test/system/generation:simple.document.template.source",
"//test/system/generation:simple.document.cases.source",
"//test/system/generation:simple.document.execution.source",
"//test/system/generation:complex.document.template.source",
"//test/system/generation:complex.document.cases.source",
"//test/system/generation:complex.document.execution.source",
"//test/system/generation:library.document.template.source",
"//test/system/generation:library.document.cases.source",
"//test/system/generation:library.document.execution.source",
"//test/system/generation:returns.document.template.source",
"//test/system/generation:returns.document.cases.source",
"//test/system/generation:returns.document.execution.source",
"//test/system/graph/similarity:similarity.document.template.source",
"//test/system/graph/similarity:similarity.document.cases.source",
"//test/system/graph/similarity:similarity.document.execution.source",
],
)
distribute
Serves the workspace directory over HTTP for local preview.
distribute(
name = "distribute.documentation",
folder = ":documentation",
tags = ["ibazel_notify_changes"],
)