Docs site
Purpose
Section titled “Purpose”The engine’s website is built with Astro Starlight and themed like the editor: the same palette, fonts, icons and logo. It has two parts:
- The landing page at
/: the engine at a glance, features, screenshots and an Editor section that links to the editor’s repository and releases (see Landing page). - The showcase at
/showcase/: the Forest and Neon, the games in the showcase repository (see Showcase page). - The docs under
/docs/: the repository’s Markdown indocs/, searchable.
just docs serves it locally with live reload. .github/workflows/docs.yml deploys it to GitHub Pages with each
release, at https://engine.mainframe.games/ (a custom domain; engine.mainframe.games is a CNAME to
mainframe-games.github.io, set as the repository’s Pages custom domain).
The Markdown stays the source of truth. The site is generated from it and adds nothing that GitHub or an IDE would not show; links in the Markdown keep working in both places.
Running it
Section titled “Running it”just docsThat serves http://localhost:4321/mainframe-engine/ (the landing page; the docs are at …/docs/) and opens it in
the browser.
- Requirements: Node 22.12 or later.
- First run: it runs
npm ciindocs-site/. It does the same again afterpackage-lock.jsonchanges, for example after a pull. - Live reload: changes to
docs/**re-sync that page and the browser reloads. - Arguments:
--no-openskips opening the browser; anything else passes through toastro dev, for examplejust docs --host.
just docs-buildThat builds docs-site/dist exactly as CI does, including the Pagefind search index, which astro dev does not build.
npm --prefix docs-site run preview serves the result.
Layout
Section titled “Layout”| Path | What |
|---|---|
docs-site/package.json, package-lock.json | Astro, Starlight, @astrojs/markdown-remark (Starlight’s peer; the unified processor), Mermaid, sharp, pinned exactly |
docs-site/astro.config.mjs | Site, base path, sidebar, theme hooks, Expressive Code settings |
docs-site/scripts/sync-docs.mjs | Turns the repository’s Markdown into src/content/docs and copies images, logo and fonts |
docs-site/scripts/dev.mjs | just docs: install if needed, sync, astro dev, watch and re-sync |
docs-site/src/styles/theme.css | The editor theme (see Theme) |
docs-site/src/styles/landing.css | The landing page’s layout and animations |
docs-site/src/pages/index.astro | The landing page (see Landing page) |
docs-site/src/components/landing/ | Its sections in page order (LandingHero, Showcase, WhyMainframe, Features, Editor), the showcase games’ data (games.ts, for pages/showcase.astro), the grid canvas (grid.ts), the logo animation (logo.ts) and TablerIcon |
docs-site/src/icons/ | The Tabler icons (MIT, LICENSE beside them) the landing page uses, vendored from the editor’s set; add one by copying its outline SVG here |
docs-site/src/components/Head.astro | Starlight’s <head> plus the Mermaid renderer and the lightbox |
docs-site/src/components/Lightbox.astro | The lightbox: landing screenshots, docs images and Mermaid diagrams over the whole window (see Lightbox) |
docs-site/src/components/Hero.astro | Starlight’s hero, replaced on the landing page by LandingHero |
docs-site/src/components/SocialIcons.astro | The header’s Docs, Showcase and Editor links before Starlight’s GitHub icon |
docs-site/src/components/Search.astro | Starlight’s search, rendered only under /docs/ (the landing and showcase pages have none) |
docs-site/src/plugins/remark-mermaid.mjs | Turns ```mermaid blocks into <pre class="mermaid"> |
docs-site/src/content.config.ts | The Starlight docs collection |
These paths are generated and ignored by git:
src/content/docs/src/assets/(logo, fonts)public/images/public/favicon.svgpublic/logo-512.pngdist/node_modules/
Never edit the generated pages: edit the Markdown in docs/.
Pages and routes
Section titled “Pages and routes”| Source | Route | Sidebar |
|---|---|---|
docs-site/src/pages/index.astro | / (the landing page, no sidebar, not in search) | — |
docs-site/src/pages/showcase.astro | /showcase/ (the showcase games, no sidebar) | — |
docs/README.md | /docs/ | Start › Overview |
docs/getting-started.md | /docs/getting-started/ | Start › Getting started |
docs/milestones.md | /docs/milestones/ | Start › Milestones |
docs/images/brand/README.md | /docs/brand/ | Start › Brand |
docs/design/*.md | /docs/design/<name>/ | Design |
docs/design/future/*.md | /docs/proposals/<name>/ | Proposals (collapsed; “Proposal:” dropped from labels) |
Not published: the ADRs (memory/decisions/), the plans (docs/superpowers/) and the working notes | ||
(memory/context/). Links to them go to GitHub. |
The sync script does four things to each page:
-
Title. The page’s first
#heading becomes its frontmatter title and is removed from the body. -
Edit link. Every page gets an
editUrlpointing at its source file on GitHub. -
Link rewriting. Links are rewritten outside code:
- to another published page → its route, anchors kept (Starlight’s heading ids match GitHub’s);
- into
docs/images/→ the copied image; - to any other file in the repository (source, tests, workflows,
memory/context) →github.com/…/blob/main/…, ortree/mainfor folders.
Inline links, reference definitions and HTML
src/hrefare all handled. -
Missing targets. A link to a file that does not exist prints
warning: … link to missing …. The build does not fail, but the warning means the doc has a stale link.
Version
Section titled “Version”The site title is “Mainframe Engine” plus the engine version the docs describe: the latest release tag (vX.Y.Z, see
Release) reachable from the built commit, found with git describe. Without a tag it is dev;
DOCS_VERSION overrides it. The live site is built from the released commit, so it describes exactly that release;
docs merged to main since then go live with the next release.
DOCS_BASE (default /) and DOCS_SITE (default https://engine.mainframe.games) override the
base path and origin, for example /mainframe-engine/ + https://mainframe-games.github.io to build for the
github.io project site instead of the custom domain.
theme.css maps Starlight’s colour variables onto the editor palette
(the editor repo’s MainframeEngine.Editor/Assets/Editor/theme.rcss):
| Role | Dark (default) | Light |
|---|---|---|
| Page | panel #1f2128 | #ffffff |
| Header | base #15171c | #f4f5f8 |
| Sidebar | #1a1c22 | #f8f9fb |
| Code and fields | field #121418 | #f4f5f8 |
| Lines | #2f333d | #d7dbe4 |
| Text and headings | #d7dbe4 / #e8ebf2 | #2f333d / #15171c |
| Accent | #3b82f6; the selected page uses the editor’s selection #1d4ed8 | #1d4ed8 |
The rest of the editor’s look carries over too:
- Fonts: the editor’s Lato and Roboto Mono (SIL OFL), copied from
MainframeEngine/Assets/UI/fonts. - Logo and favicons: the logo is
docs/images/brand/logo.svg; the favicon islogo-small.svg, plus the 512 px PNG. - Code blocks: Expressive Code with GitHub’s dark and light themes on the field colour.
- Mockups: SVGs drawn on white get a framed white panel in the dark theme.
- Icons: the editor’s Tabler icons (MIT): the ones the landing page uses are vendored in
src/icons. - Theme picker: Starlight’s picker (auto, dark, light) stays.
Landing page
Section titled “Landing page”src/pages/index.astro is a StarlightPage with the splash template, so it keeps Starlight’s header, theme picker and
fonts (not the search: Search.astro shows it only on the docs). Starlight’s Hero component is overridden: on / it renders LandingHero, on any other page
Starlight’s own hero. The sections are marked not-content, so Starlight’s Markdown styles leave them alone. In page
order: the hero, the showcase, why Mainframe, the features, the Editor section and a closing call to action.
- Hero. A full-width canvas (
grid.ts) draws the editor’s scene grid in perspective: minor and major lines scrolling toward the viewer, data pulses running down them, stars above a glowing horizon. The vanishing point follows the pointer. Its colours are the--mf-grid-*properties inlanding.css, read again when the theme changes. The inline logo (src/assets/logo.svg, fromdocs/images/brand/logo.svg) builds itself (logo.tstags its parts forlanding.css): the dots fade in from the core, the “M” draws, its joints pop, the core pulses, and a ripple runs out through the dots. The logo tilts toward the pointer. - Editor. The editor lives in its own repository (mainframe-editor, ADR 0289), so the page has no downloads of its own: one card links to the editor’s latest release, and the text links to its repository. The hero’s Get the editor button and the header’s Editor link scroll to it.
- Features. One card per subsystem in five groups (rendering, worlds, gameplay, audio, tools), each linking to its
design doc. A new subsystem gets a card in
Features.astro. - Why Mainframe, after the showcase: the README’s “Why Mainframe?” as two groups of
Features-style cards, “The game is the engine” and “Why not Godot?”, each card linking to the doc that backs it, and a closing note on the trade-offs. Keep it in step with the README section. - Every feature is on the page. A user-facing engine feature gets its card in
Featuresand its row in the README’s Features tables (grouped like the cards). Editor features go on the editor’s own site. - Showcase, first after the hero (the eye-catching sections lead, the Editor section comes last): one shot per Demo
scene, all from
docs/images, then a View the showcase button to the showcase page for the Forest and Neon. Clicking a shot opens it in the lightbox. - Motion. Sections fade and rise into view (
[data-reveal], anIntersectionObserver); cards light up under the pointer. Underprefers-reduced-motionnothing animates and the grid is one still frame. The canvas stops drawing while it is off screen or the tab is hidden.
Showcase page
Section titled “Showcase page”src/pages/showcase.astro (/showcase/, linked from the header as Showcase) is a StarlightPage in the splash
template with Starlight’s own hero (“Made with Mainframe”, links to the showcase repository and its releases). One
section per game, from components/landing/games.ts: what it is, what it shows, links to its source and its design doc
in the showcase repository, its six README shots in the large-first layout, then every other shot
(reference views, menus). A closing call to action points at the editor download: the Project Manager’s Download
button fetches the Forest and Neon as projects. A new showcase game, or a new shot of one, goes in games.ts; its
images must be in this repository’s docs/images.
Lightbox
Section titled “Lightbox”components/Lightbox.astro, on every page through Head.astro: a click (or Enter on a focused one) on a landing
screenshot (.mf-shot[data-full]), a docs image or a drawn Mermaid diagram opens it in a <dialog> over the whole
window, scaled to fit at its own aspect ratio (small images scaled up). A diagram is a copy of its SVG on the code-block
background; the white mockup SVGs keep their white. ‹ › and the arrow keys step through the page’s other images and
diagrams; Esc or a click anywhere else closes it. Images inside links, and the landing’s own <img>s
(.not-content, opened through their .mf-shot), are left alone. Styles in theme.css.
Diagrams
Section titled “Diagrams”The sync script leaves ```mermaid fences alone. Then:
remark-mermaidturns each fence into<pre class="mermaid">before Expressive Code highlights code blocks.Head.astroloads Mermaid in the browser only on pages that have diagrams.- It renders them with the editor palette (
theme: 'base'with theme variables), and redraws them when the theme picker changes.
In a sequenceDiagram, ; ends a statement, so a message containing one fails to parse, on GitHub too. Write #59;
for a literal semicolon in message text.
Deployment
Section titled “Deployment”The site deploys only with a release: merging to main does not publish docs.
- After a successful release (
publish.yml, throughworkflow_run) it checks out the commit the release was built from (workflow_run.head_sha), builds the site, uploads the Pages artifact and deploys it withactions/deploy-pagesto thegithub-pagesenvironment. The new tag is the version in the title. A failed release run (any job, including the nuget.org push) deploys nothing. workflow_dispatch(gh workflow run docs.yml) rebuilds and redeploys frommain’s tip by hand, for example after a failed post-release deploy. That publishes whatever docsmainhas.- On pull requests that touch
docs/**,docs-site/**, the engine’s UI fonts or the workflow, it builds the site without deploying it. It is not part ofci-success, and a docs-only change does not wait on it. - History. The checkout fetches full history and tags (
fetch-depth: 0) for the version. - LFS. Only
docs/images/**is fetched from Git LFS (the PNG screenshots), cached by object ID likeci.yml.
One-time setup: in the repository’s Settings › Pages, set the source to GitHub Actions. Until then the deploy job fails with “Pages not enabled”.
Known issues
Section titled “Known issues”- No search in
astro dev. Search (Pagefind) exists only in built output;just docsshows a notice in the search box. - Inline HTML-like text. Text such as
List<T>outside code spans is parsed as HTML by the Markdown processor, as on GitHub; it should be in backticks. - Deleted sources (the dev watcher removes them) and renamed folders under
docs/imagesneed a restart ofjust docsif the browser keeps a stale page.