OpenProgram Docs

Docs site

Rendering paths

SourcePublishedAuthor owns
HTML documentArticle on the shared foundation, plus a generated .html.md copyContent only; see Writing a docs page
MarkdownArticle in the site layoutGenerated reference pages only; hand-written pages are HTML documents
Interactive prototypeSite page with an iframe, plus a .raw.html payloadOwn layout, theme and internal navigation

Only pages in PROTOTYPE_PAGES (governance/policy.py) take this path; any other page that breaks the format fails the build. See Docs governance. The iframe separates layout; it is not a sandbox for untrusted scripts.

Implementation ownership

OwnerResponsibility
scripts/docs_site/nav.pyDiscovery, language pairing, nine tabs, section placement, PAGE_ORDER
scripts/docs_site/build.pyRendering, relative links, static assets, search records, redirects, atomic output
scripts/docs_site/html_source.pyHTML document parsing, heading ids, Markdown copy
scripts/docs_site/template.pyShared layout and page metadata
scripts/docs_site/search.pySearch index
scripts/docs_site/assets/site.cssFoundation: type, spacing, responsive layout, light and dark tokens
scripts/docs_site/assets/site.jsNavigation, language, search, fullscreen, code copy
scripts/docs_site/assets/theme.jsTheme controller, runs before the body is parsed
openprogram/interfaces/server/routes/docs.pySource or packaged site selection, the default worker's /docs/ mount

Reading and visual design

New pages are HTML documents on one foundation: neutrals with a single blue accent, light and dark. Prototype pages work through --bg, --bg-code, --tx, --tx-soft, --acc and --bd, aliases of the foundation tokens. An article never repeats a fixed light-only palette.

  • A page starts from its question, reader, scope and implementation boundary; public entry and data flow come before detail; remaining work closes the page.
  • Stable heading id values feed the page navigation.
  • Diagrams have an accessible title and description. Native disclosure holds detailed evidence. Keyboard focus, reduced motion and phone reading are part of acceptance.
  • Wide tables stay in keyboard-accessible horizontal scroll regions at a readable column width. Standalone HTML also gets diagram scroll regions and an opaque fallback canvas when it defines no background. These helpers do not certify the implementation a page describes.
RuleBehaviour
Tabsstart, install, capabilities, interfaces, models, integrations, server, reference, virtual design. Design sources stay under docs/reference/design/.
OrderTAB_SECTIONS sets reading order, PAGE_ORDER page order. An entry naming topic.md also applies to topic.html once the Markdown is gone. Other pages group by directory, under configured labels or README titles. The sidebar is not a filesystem tree.
LanguageEnglish is default. topic.zh.md pairs with topic.md, topic.zh.html with topic.html, reached through the language control. Change both together.
Same-name companionsBeside a Markdown source, the HTML output is topic.viz.html (Chinese topic.zh.viz.html). A relative topic.md link targets the text, topic.html the companion, keeping its anchor. Compatibility only; compare and merge rather than keep two explanations.
Excluded_site, _site.tmp, _site.old, _static_root, images, node_modules. A leading underscore alone excludes nothing.

Build and serving

python -m scripts.docs_site.check --all
python -m scripts.docs_site.build
python -m scripts.docs_site.checklinks
python -m scripts.docs_site.checklang
python -m scripts.docs_site.check_landing

Run from the repository root with the docs dependencies; the contributor guide lists the uv run form. check needs no build; checklinks reads built HTML, so build first. checklang scans default-language sources, not the pairing with Chinese.

StageBehaviour
BuildRegenerates CLI, config and provider reference pages, writes docs/_site.tmp/, then replaces the Git-ignored docs/_site/.
docs/_static_root/Copied in, outside navigation and search; {{SITE_URL}} in its text files becomes the site address. .github/workflows/docs-pages.yml moves root files (robots.txt, sitemap.xml, llms.txt, Search Console proof, IndexNow key, and CNAME when the build writes one for a custom domain) to the site root and checks the proof's contents. The generated sitemap.xml is the only sitemap.
Source checkoutServes its docs/_site/. The worker checks for a rebuild when registering routes; HTTP reads never scan or rebuild. No watch mode.
Installed runtimeServes the bundle under the Server's _frontend/docs/. Rebuilding another checkout does not update it: compare the served page before claiming acceptance.
Design alternatives

The in-repository Python renderer keeps native HTML, SVG and script content and fits the single-port worker. It uses markdown-it-py, mdit-py-plugins and Pygments, with no client framework, editor or CMS. This compares against this project's needs, not current external products.

ConsiderationPython rendererVitePressMkDocs
Native visual documentsKept as fragments or independent pagesComponent and layout integration to evaluateRaw-HTML and theme integration to evaluate
Navigation, searchMaintained hereBuilt-in, to evaluateBuilt-in, to evaluate
ToolchainPython, static browser assetsAdditional Node buildPython build and theme configuration
MaintenanceProject owns layout, navigation, accessibilityFramework configuration and upgradesFramework, theme configuration and upgrades

Reader navigation

PartBehaviour
LayoutCategory tabs above grouped page navigation, central reading column, section index. Narrow: page index becomes a drawer; section index sits behind an expandable reading-progress control.
IndicatorOne continuous dashed line from the first row to the selected row, rounded at the label center; height changes within a group. Hover and focus preview a separate neutral indicator. Focus is a text underline and subtle row background. Filtering, wrapping, language and resize recompute geometry.
ProgressTracks the active heading in the current scroll container. The disclosure exposes real anchors; choosing one closes it and moves there; Escape and outside clicks dismiss. SPA navigation rebuilds references. Fullscreen uses the content scroller. Hidden for standalone iframes. Reduced motion disables animated scrolling.
Code blocksLanguage header and an always available copy button outside horizontal overflow. Copies code text only and reports success or failure. Authored copy controls stay.
Root overviewExplicit English and Chinese labels, not filename-derived.
DependenciesNo external runtime requests.
Interaction references and acceptance

Rare UI Hook Sidebar, Scroll Progress and Code Block inform an independent implementation in the static assets. No Rare UI source or React dependency is included; reusing component source has separate licensing requirements. Decorative orb, proximity scaling and gooey navigation are excluded because stable text targets matter for reading.

Acceptance: deep links, category and page changes, browser history, language switching, keyboard dismissal, code copying, long and short articles, fullscreen, phone overflow, iframe isolation.

Design information architecture

Three levels: area, module, page. Seven areas: architecture, agents and workflows, context and memory, interfaces, models and external connections, security and engineering, supporting material. The landing page uses the same seven. Architecture lists entry pages directly.

  • Each page belongs to one module. Loading or navigating to a page expands its ancestors.
  • Filtering matches page and category names, keeps matching ancestors open; clearing restores the prior state at every level. Native details and summary give keyboard operation.
  • New pages appear in an Uncategorized area.
  • Both languages share hierarchy, order and output mapping.
  • Prototypes, implementation records and research stay distinct under Supporting material and do not imply implemented behavior.
Sidebar hierarchy and acceptance
ElementRule
Label sizeArea 13px, module 12px, page 13px
LayoutModules indent 12px only; pages align and wrap naturally
CountsArea level only
SelectionContinuous indicator and accent text, no background fill
HoverStays transparent
Keyboard focusA separate inset ring; no underline on multiline labels
BordersNo redundant vertical borders
ScopeDesign navigation only, in both themes and on narrow screens

Acceptance: complete unique membership, seven top-level entries, ancestor expansion, filter restoration, bilingual and phone behavior, compatibility with other tabs.

Canonical documents and stable URLs

  • One topic, one maintained source. A merge keeps unique diagrams, constraints, status and evidence, and every retired heading as an anchor. Rationale and model-selection analysis sit beside the design contract; usage guides and API references stay separate.
  • Filenames are descriptive lowercase hyphenated words, with no dates, TODO or PROBLEM prefixes. Deferred proposals state it in the title.
  • Inside a subsystem directory, names and titles omit the subsystem: context/statistics.html, memory/editor.html, runtime/dag/layout.html. Established terms stay when dropping a word changes meaning. A diagram qualifier is used when a text page already owns the shorter name.
Redirect aspectRule
Sourcedocs/redirects.json, retired output paths to canonical pages, including standalone raw and companion URLs
OutputRedirect-only HTML outside navigation, search and sitemap; query strings and fragments kept
ExecutionSame-origin redirect.js under the worker's CSP; no inline scripts. SPA navigation does a full load, reloading when history already selected that URL
ValidityTargets exist; aliases never replace real pages or point to another alias, or the atomic build aborts. Old aliases flatten to the latest output. Language-specific URLs keep their language when a counterpart exists

Acceptance: each surviving source discovered once, every old URL resolves directly, unique content retained, links and language pass, navigation and redirects verified on the default local mount. Consolidation does not certify deferred designs.

Language consistency

ItemRule
Authored documentsFull English and Chinese bodies, including diagrams, code, identifiers, links and status boundaries
Headings, visible diagram labelsFollow the document language
Sidebar, breadcrumbs, previous/next, searchLocalized title and destination
Language checksCover design notes, HTML, SVG and accessible labels, keeping technical identifiers and compatibility anchors; interactive pages also check script-generated text
Feature matrixBoth versions use the same numeric, detail-row and chart-consistency checks
Form
Short noun phrases, separate from the full heading, in sentence case keeping proper nouns and acronyms
English
Prefer two or three words; one if unambiguous; at most four words and 26 characters
Chinese
At most 12 characters
Removed
Product or parent prefixes, completeness claims, code signatures, parentheticals
Modifiers
Diagram, comparison, prototype, used consistently
Uniqueness
Within the same leaf section
Source
One bilingual catalogue, page_titles.json, keyed by canonical source path, supplies navigation, breadcrumbs, search and previous/next. Generated reference names stay code-derived
Check
Labels fit the sidebar without clipping or ellipsis; bodies, URLs, anchors and hierarchy unchanged

Documentation completeness

The repository README, with a Chinese counterpart of the same structure, introduces the project, verified entry commands, examples and citation. The docs homepage directs to the nine tabs rather than repeating it. Reference overviews link to task guides and generated details.

Reference generation emits English and Chinese pairs from the same argparse tree, settings schema and provider manifests; names, flags, keys, defaults and protocol values stay exact.

  • A source-string catalogue (reference_zh.json) supplies Chinese; a missing translation fails generation.
  • Both languages traverse every command depth with the same options, and write only when content changes. Removed command pages go in both.
  • Reads schema defaults, never user configuration; no credentials.
  • Generators finish before discovery; failure aborts the build.

Acceptance: all reference pairs, recursive option parity, missing-translation failure, idempotence, stale-page removal, homepage language links, short names, links, language checks, visible language switching on the default local instance.

Theme preference

AspectBehaviour
PreferencesSystem, light, dark, in op-docs-theme. Missing or invalid values resolve to system
SystemFollows prefers-color-scheme live
Cross-tabA storage event updates the preference without writing it back
Storage failureIn-memory controls and system following keep working
First paintSynchronous same-origin theme.js in the head applies palette, color-scheme and syntax styles before the body parses; replaces an inline bootstrap the script-src 'self' policy rejects
ControllerOwns state, media listeners and the accessible, localized three-option menu; survives SPA navigation; dispatches documentThemeChange on the window
BoundaryDoes not change standalone iframes, which do not receive the event, or the operating system appearance

Acceptance: first load in both palettes, live system change, overrides and return to system, invalid values, unavailable storage, cross-tab, menu keyboard and language, code colors, SPA navigation. Browser media emulation is restored afterwards.

Heading hierarchy

  • A page with no on-page contents hides the empty column and gives it to the article; the fullscreen control stays at the right edge; SPA navigation updates this.
  • Nested lists cover h2 through h6. Each heading belongs to the nearest preceding shallower heading; skipped levels make no empty groups. Order, labels and anchors are unchanged.
  • Each group has its own indented dashed guide. The selected heading and ancestor path get group-owned indicators; no line spans unrelated depths. Neutral child guides show structure before a child is selected.
  • Headings with children use the sidebar's details/summary chevron, which toggles only that subtree; the link still navigates. Leaves have no chevron and keep curved guide endpoints. Groups start expanded and scrolling respects user collapse; a collapsed active descendant marks its parent path, tracking the nearest visible ancestor. No row boxes on hover or selection.
  • Endpoints use actual wrapped rows. Previews stay within the sibling group. One aria-current location. Resize and SPA changes recompute geometry and dispose old observers.

Acceptance: multiple parent groups, skipped levels, deep headings, wrapped rows, active ancestors, hover, resizing, SPA navigation.

Implementation status

AreaStateBoundary
HTML document, generated Markdown and prototype renderingImplementedEach path has its own layout responsibility
Bilingual routing, nine tabsImplementedPairing does not translate the body
Atomic build, packaged servingImplementedA successful build does not update an installed bundle
Shared foundationApplied to HTML document pagesRemaining standalone pages need individual review
Frontmatter scripts, styles injectionNot implementedUse supported HTML paths
Continuous source watchingNot implementedRebuild explicitly
Last updated · 2026-11-25