doc
doc::Assets Ships the prebuilt presentation bundles, authored in the `web/` Svelte package and embedded at build time (LANG.md §9.3). `style.css`, `client.js`, and `universe.js` ship once at the site root; `ssr.js` is build-time only — the engine (`Doc::Ssr`) evaluates it and it is never written to the site. The universe bundle is the only one that carries WebGL; the SSR bundle never does.
Scenarios
Shared assets ship once and every page links them.
- given a multi-page site
- when it is generated
- then style.css and client.js are emitted once at the site root
- and every page links them by a depth-relative path rather than inlining them
doc::Call doc::Codec doc::Crumb One breadcrumb hop: its label and href; the trailing crumb (the current page) carries no href.
Inbound
- from doc::Pages
- from doc::Pages
- from doc::Pages
- from doc::Pages
- from doc::Pages
doc::DiagnosticInput One host-prepared diagnostic, positioned in its module's source: severity word (`error`/`warning`), the stable rule code and its principle-article URL (empty for plain diagnostics), the message, and the 1-based line/column with the byte span. The host computes line/column once — this crate never sees module sources.
doc::Diagram A diagram figure. Every view — C4, sequence, data, feature — ships as deterministic server-rendered SVG, identical to `pds svg` (the client adds pan/zoom only); `kind` is the view word (`c4`/`sequence`/`entity`/`flow`) the figure exposes as its `data-diagram` hook. `Empty` marks a view that failed to project.
Inbound
- from doc::Diagrams
- from doc::Diagrams
- from doc::Diagrams
doc::Diagrams The bridge into `emit`: project a view into a `Scene` and render it to the same deterministic SVG `pds svg` emits, under the adaptive palette so the figure follows the site theme. A view that fails to project degrades to an `Empty` placeholder rather than aborting the build — the cargo-doc stance that a partial model still documents. The client adds pan/zoom around the figure; it never re-lays-out.
Parent
- for doc::Doc
Inbound
- call doc::Pages · context
- call doc::Pages · forNode
- call doc::Scenarios · flows
Outbound
- from → doc::Diagram
- from → doc::Diagram
- from → doc::Diagram
- call → emit::Emit · project
Scenarios
Every diagram ships as deterministic server-rendered SVG.
- given a node that anchors a C4 boundary, owns a triggered callable, or is a data type
- when its page is rendered
- then a system carries a container diagram and a container carries a component diagram
- and each triggered callable carries its sequence diagram
- and every figure is the same deterministic SVG pds svg emits, under the adaptive palette
- but the client adds pan and zoom only — it never re-lays-out a diagram
A failed projection degrades to a placeholder rather than aborting.
- given a view that fails to project with an EmitError
- when the figure is built
- then an Empty placeholder figure is produced in place of the diagram
- but the build continues and the rest of the site still renders
doc::Doc `crates/pseudoscript-doc`. Turns a resolved graph into a Svelte-rendered, cargo-doc-style site that fully represents the system: each node's `///` docs and relationships on its page, every diagram as deterministic server-rendered SVG, the 3D universe with its flows, the architecture-health report, and a static full-text search index. Pure: returns in-memory files, the CLI writes.
Parent
Inbound
- call cli::DocCmd · prepareDiagnostics
- call cli::DocCmd · render
- call cli::DocCmd · renderMarkdown
- call ide::Docs · prepareDiagnostics
Outbound
- from → doc::DiagnosticInput
- from → cli::Result
- call → doc::SiteBuilder · render
- call → doc::Pages · buildAll
- call → doc::MarkdownSite · render
- call → doc::Health · prepare
- from → doc::DiagnosticInput
Scenarios
A partial model still documents.
- given a resolved graph and the [doc] configuration
- when the site is rendered
- then an index, one page per module, and a section per node are produced
- and the files are returned in memory, with no filesystem I/O
doc::DocBody doc::DocConfig Site presentation, filled by the CLI from the `[doc]` table of `pds.toml`. `[doc]` tunes presentation only, never what is documented.
doc::DocGroup One `[[doc.sidebar]]` group of authored Markdown pages: a heading and its ordered pages, rendered above the auto-generated module tree.
doc::DocPage One authored Markdown page: its sidebar title, the source path (relative to `pds.toml`) from which the host and this crate derive the same stable slug, and the raw Markdown the host has already loaded, rendered to HTML at build time. The crate reads `markdown`; `path` only names the page, never loads it.
doc::Empty doc::Engine doc::Escape All user text — node names, `///` docs, tags, the site title — is carried raw in the props and escaped on interpolation by the renderer; this escaper guards the Rust-owned document shell, where the title and theme become HTML attributes.
Scenarios
Document attributes are HTML-escaped; content is escaped by the renderer.
- given a site title containing HTML-significant characters
- when the document shell is assembled
- then the five significant characters are escaped in the document attributes
- but page content text is carried raw and escaped by the renderer on interpolation
doc::Health Positions the host's diagnostics in the documentation: prepares raw per-module findings (line/column from sources), attributes each to the node whose section it belongs on, and builds the health page and the per-section badges. Attribution is positional: the node whose declaration starts closest before the diagnostic's span owns it, a callable lifting to its owner; a span no node encloses falls back to the module page.
Parent
- for doc::Doc
Inbound
- call doc::Doc · prepare
- call doc::Pages · page
- call doc::Pages · badgesFor
Outbound
- from → doc::PageBody
- from → doc::SectionDiagnostic
- from → doc::HealthEntry
- from → doc::number
- from → doc::number
Scenarios
The health page lists every finding; affected sections carry badges.
- given host-prepared diagnostics including an architecture lint
- when the site is rendered
- then the health page lists each finding with severity, code, location, and its principle-article link
- and each entry deep-links to the owning node's documentation section
- and the affected section shows an inline badge
- but a clean model renders an empty health page, not a missing one
doc::HealthEntry One architecture-health finding, attributed to the node whose section it belongs on: the diagnostic fields plus the owning node's FQN and the (prefixed) href to its section — the module page when no node encloses the span.
Inbound
- from doc::Health
doc::HealthPage doc::Highlight Highlights fenced code blocks at build time, so the shipped site needs no client highlighter and one deterministic output serves every theme: PseudoScript through the toolchain's own lexer, emitting class-based spans coloured by the site stylesheet. Any other language passes through escaped and unhighlighted — an embedded grammar set for common languages is a deliberate future extension (it would bloat the IDE wasm today).
Parent
- for doc::Doc
Scenarios
Code blocks are highlighted at build time.
- given an authored doc page with fenced code blocks
- when the page is rendered
- then PseudoScript blocks highlight through the toolchain lexer
- and output is class-based spans so one deterministic render serves every theme
- but any other language passes through escaped and unhighlighted
doc::IndexPage doc::Markdown Renders an authored `[[doc.sidebar]]` page's Markdown source into the HTML that fills its `Doc` page body (LANG.md §9.3). The host has already loaded the source into the page's `markdown`; this crate does no I/O and renders that content in memory. The rendered HTML carries through unescaped as trusted authored content.
doc::MarkdownSite The static Markdown output mode: turns the same per-page props the HTML renderer consumes into flat `.md` files, each diagram a standalone `.svg` asset referenced as an image. The universe page renders as text lists (nodes by level, edges with traffic, each flow's legs); the health page as a table with article links. No SSR engine, no shared assets, no logo — the engine-free site for wikis and code hosts.
Scenarios
The Markdown site is the engine-free twin of the HTML site.
- given the same resolved graph and configuration
- when the Markdown site is rendered
- then one .md per page mirrors the HTML site's paths
- and each diagram is written as a standalone themed .svg asset referenced as an image
- but no SSR engine runs and no shared assets or logo are emitted
doc::ModuleCard A module card on the index: its FQN, the (prefixed) href to its page, and an "N item(s)" line.
Inbound
- from doc::Pages
doc::ModulePage doc::NodeHref A universe node's documentation link: its id and the (prefixed) href to its section, so clicking a sphere can navigate to the docs.
Inbound
- from doc::Pages
doc::NodeSection One node's documentation section: head fields, `///` docs, tags, relationship groups, scenario cards, embedded diagrams, and the health findings attributed to the node (rendered as inline badges).
Inbound
- from doc::Pages
doc::NodeUrl A resolved cross-reference target: the module page it lives on and its in-page anchor id. A cross-link uses these to build an `href`; an unresolved FQN has no entry and renders as plain text.
doc::PageBody The page body: the landing index, one authored doc page, one module's page, the 3D universe, or the architecture-health report.
Inbound
- from doc::Health
doc::PageProps The serialisable model for one page, handed to the Svelte server renderer. Every derived value (resolved hrefs, anchors, edge labels, counts) is precomputed here so the Svelte components do no graph logic. User text is carried raw — the renderer escapes it on interpolation. `docGroups` carries the authored `[[doc.sidebar]]` navigation shown above the module tree; `nav` carries the header links (Overview, Universe, Health with its finding count); `crumbs` is the breadcrumb trail. Only the universe page's props are also embedded in the document, for its 3D island — every other page ships no page data.
Inbound
- from doc::Pages
doc::Pages Projects the resolved graph into per-page `PageProps` — pure data, no markup. Builds the index props (title, context diagram, module cards), each module page's node sections, and the depth-prefixed sidebar tree mirroring the C4 hierarchy.
Parent
- for doc::Doc
Inbound
- call doc::Doc · buildAll
- call doc::SiteBuilder · sortedModules
- call doc::SiteBuilder · index
- call doc::SiteBuilder · universePage
- call doc::SiteBuilder · healthPage
Outbound
- from → doc::PageProps
- from → doc::string
- from → doc::SidebarDocGroup
- from → doc::SidebarModule
- from → doc::NavLink
- from → doc::Crumb
- from → doc::ModuleCard
- call → doc::Diagrams · context
- from → doc::SiteStats
- from → doc::SidebarDocGroup
- from → doc::SidebarModule
- from → doc::NavLink
- from → doc::Crumb
- call → universe::Universe · fromModel
- call → universe::Universe · snapshot
- call → universe::Universe · flows
- from → doc::NodeHref
- from → doc::SidebarDocGroup
- from → doc::SidebarModule
- from → doc::NavLink
- from → doc::Crumb
- call → doc::Health · page
- from → doc::SidebarDocGroup
- from → doc::SidebarModule
- from → doc::NavLink
- from → doc::Crumb
- call → doc::Markdown · render
- from → doc::SidebarDocGroup
- from → doc::SidebarModule
- from → doc::NavLink
- from → doc::Crumb
- from → model::GraphNode
- from → doc::NodeSection
- call → doc::Relationships · groups
- call → doc::Scenarios · cards
- call → doc::Diagrams · forNode
- call → doc::Health · badgesFor
Scenarios
The universe page ships the 3D structure and its flows.
- given a resolved model with entry-point flows
- when the universe page is built
- then the flat snapshot, the traced flows, and each node's documentation href are embedded
- and the 3D island lays the graph out in the browser and links spheres to their docs
- but a browser without WebGL keeps the server-rendered fallback listing
The sidebar tree mirrors the C4 hierarchy.
- given modules whose nodes nest containers, components, and declarations
- when the sidebar is rendered
- then each module holds its top-level nodes and every node nests its same-module children
doc::RelGroup One relationship group ("Parent", "Inbound", or "Outbound") and its endpoints.
Inbound
- from doc::Relationships
- from doc::Relationships
- from doc::Relationships
- from doc::Relationships
doc::RelItem One relationship endpoint: the edge-kind word, whether to draw the outbound arrow, the endpoint FQN, its resolved href (absent → plain text), and any label.
doc::Relationships Renders a node's relationships (LANG.md §9.3): its `for`/owner parent, inbound edges, and outbound edges, skipping the structural `for`-parent edge kind. Each endpoint is a cross-link when its FQN resolves, plain text otherwise.
Parent
- for doc::Doc
Inbound
- call doc::Pages · groups
Outbound
- from → doc::RelGroup
- from → doc::RelGroup
- from → doc::RelGroup
- from → doc::RelGroup
- from → doc::string
- call → doc::Urls · hrefTo
doc::RenderError Why server-rendering a page failed. Every variant is a defect in the bundle, the engine, or the props codec — never user model data; well-formed props always render.
doc::RenderedPage The server-render result for one page: the `<svelte:head>` contents and the rendered body markup, dropped into the document shell.
doc::ScenarioCard One BDD scenario card: name, `///` docs, tags, the ordered steps, and the feature's flow figure (LANG.md §9.5).
Inbound
- from doc::Scenarios
doc::Scenarios Renders the BDD scenario cards on a node's page: each `feature` targeting the node becomes its given/when/then steps and its flow figure as a card (LANG.md §5.2, §9.3, §9.5). Empty when the node has no features.
Parent
- for doc::Doc
Inbound
- call doc::Pages · cards
Outbound
- from → doc::ScenarioCard
- from → model::Scenario
- call → doc::Diagrams · flows
Scenarios
Feature scenarios render on their target node's page (§9.3).
- given a model whose nodes carry `feature` scenarios
- when the site is generated
- then each node's page lists its scenarios as given/when/then cards
- but a node with no features renders no scenarios section
doc::SearchEntry One record in the static full-text search index: the symbol or page's FQN, display name, kind word, one-line summary, plain-text body, declaring module, and root-relative href. Sorted by href then FQN so the index is deterministic.
Inbound
- from doc::SearchIndex
doc::SearchIndex Builds the static full-text search index the client palette queries: one record per linkable node, module page, and authored doc page, plus the universe and health pages. Shipped as a classic-script JS assignment (`search-index.js` setting a window global) so it loads under `file://` — never fetched.
Parent
- for doc::Doc
Inbound
- call doc::SiteBuilder · build
Outbound
- from → doc::SiteFile
- from → doc::SearchEntry
Scenarios
The search index is static and file://-safe.
- given a generated site
- when the search palette opens
- then the index loads as a classic script setting a window global, never fetched
- and entries cover nodes, modules, authored docs, and the universe and health pages
- and the index is sorted and deterministic
doc::SectionDiagnostic One inline badge on a node's section: the severity, rule code, article URL, message, and source line of a finding attributed to that node.
Inbound
- from doc::Health
doc::Shell Owns the document shell that wraps each server-rendered body — the part Rust renders, not Svelte: doctype, `<html data-theme>`, font + stylesheet links, the theme pre-paint script, and the classic deferred scripts. Scripts are classic (never `type="module"`) and shared data ships as JS-global files, so the site works opened from disk (`file://`). Only the universe page embeds its props (`window.__DATA__`) — for its 3D island; every other page ships no page data and the client only progressively enhances.
Parent
- for doc::Doc
Inbound
- call doc::SiteBuilder · wrap
Outbound
- from → doc::string
- call → doc::Escape · text
Scenarios
Only the universe page carries page data; everything else is pure SSR.
- given a generated site
- when the document shells are assembled
- then the universe page embeds its props as window.__DATA__ for the 3D island
- and every script is a classic deferred script so the site works from file://
- but no other page embeds page data — the client only progressively enhances
The theme follows the OS by default, overridable in-page and in config.
- given a DocConfig carrying the system theme
- when the document shell is rendered
- then a pre-paint script applies the stored preference, else the OS scheme, else the configured default
- and diagram SVGs follow the active scheme through the --pds-* variables
- but a light or dark config pins the default without removing the toggle
doc::SidebarDocGroup One `[[doc.sidebar]]` group in the authored-doc navigation: a heading and its page links, shown above the module tree.
Inbound
- from doc::Pages
- from doc::Pages
- from doc::Pages
- from doc::Pages
- from doc::Pages
doc::SidebarDocItem One authored doc-page link in the sidebar: its title and the page href, already prefixed for the page's depth.
doc::SidebarModule One sidebar entry: a module-page link and its node tree, hrefs already prefixed for the page's depth.
Inbound
- from doc::Pages
- from doc::Pages
- from doc::Pages
- from doc::Pages
- from doc::Pages
doc::SidebarNode One node in the sidebar tree, recursing into its same-module children.
doc::Site The whole generated site as in-memory files, in deterministic order: the index, one page per authored doc (`[[doc.sidebar]]`, in declaration order), then one page per module sorted by FQN, plus the shared assets. The doc crate does no I/O; the CLI writes each file under the configured output directory.
doc::SiteBuilder Orchestrates the whole site: build the URL map, project each page's props, server render it through the SSR engine, wrap it in the document shell, and ship the shared assets plus the search index. Pure: returns in-memory `Site` files, writes none.
Parent
- for doc::Doc
Inbound
- call doc::Doc · render
Outbound
- call → doc::Urls · build
- call → doc::Pages · sortedModules
- call → doc::Pages · index
- from → doc::Result
- from → doc::Result
- from → doc::Result
- call → doc::Pages · universePage
- from → doc::Result
- call → doc::Pages · healthPage
- from → doc::Result
- call → doc::SearchIndex · build
- call → doc::Assets · shared
- call → doc::Ssr · renderPage
- call → doc::Shell · wrap
Scenarios
Generation is deterministic and pure.
- given the same resolved graph and configuration rendered twice
- when the two sites are compared
- then modules and nodes are ordered by FQN with no clock or randomness consulted
- and the file lists are byte-for-byte identical
doc::SiteFile One generated file: a site-root-relative `/`-separated path (`index.html`, `module/banking.core.html`, `style.css`, `client.js`) and its complete contents.
Inbound
- from doc::SearchIndex
- from doc::Assets
doc::SiteInfo Site-wide presentation, identical across pages: the title, the `light`/`dark`/`system` theme word, the optional logo filename, and the `../` prefix to the site root for this page's depth.
doc::SiteStats The index page's stats strip: how many systems, containers, components, flows, and health findings the model carries.
Inbound
- from doc::Pages
doc::Ssr The server-side render boundary: a JSON-string-in / JSON-string-out seam to the JavaScript renderer. The native build embeds a `QuickJS` engine that evaluates the prebuilt `ssr.js` bundle (`Doc::Assets`) in-process; a wasm host implements the same seam against its own JS engine. A defect here is a build-asset fault, never user model data.
Scenarios
Pages are server-rendered through an embedded JS engine for first paint.
- given a page's precomputed props
- when the page is server-rendered
- then the page chrome and all text content are present in the emitted HTML before any script runs
- and the renderer needs no JavaScript toolchain, only the embedded prebuilt bundle
doc::Step One scenario step: its keyword (given/when/then/and/but) and prose.
doc::Svg doc::Theme Doc-site colour scheme, written as the `data-theme` attribute on the root `<html>` to select a CSS variable set. `System` (the default) follows the OS `prefers-color-scheme`, overridable by the in-page toggle; `Light` and `Dark` pin the scheme.
doc::UniversePage doc::Urls Maps every node FQN to its page path and anchor, and resolves cross-references to module-page-relative `href`s. A module page is `module/<dotted-fqn>.html` (`::` → `.`); a node is the `#<slug>` anchor within it. Only an FQN naming a real node produces a link (LANG.md §9.3).
Parent
- for doc::Doc
Inbound
- call doc::SiteBuilder · build
- call doc::Relationships · hrefTo
Outbound
- from → doc::Result
- from → doc::Result
Scenarios
Cross-links resolve to anchors; unresolved references stay plain text.
- given a relationship endpoint named by FQN
- when the link is rendered
- then an FQN naming a real node becomes an anchor link to its section
- but an unresolved or synthesised endpoint renders as plain text