Maintaining the documentation site
This file is the operator’s guide for the MkDocs project under retrodocs/ in the repository.
To maintain retrodocs as a separate Git repo from TRSE, see STANDALONE_REPO.md at the project root (splitting history, TRSE_REPO_ROOT, deploy). The public repo is github.com/omiq/retrodocs; CI (.github/workflows/ci.yml) builds on each push/PR.
What this is
- Tool: MkDocs with Material for MkDocs theme.
- Source: Markdown (
.md) underretrodocs/docs/. - Config:
retrodocs/mkdocs.yml. - Output: static HTML in
retrodocs/site/aftermkdocs build(ignored by git).
Why MkDocs + Material (Python)
- No Node/npm for this subproject — only Python and
pip. - One command to preview locally, one to build static files suitable for any web server or static host.
- Built-in search (client-side index) without a database.
First-time setup on your dev machine
cd retrodocs
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
mkdocs serve
Open http://127.0.0.1:8000 — edits to docs/**/*.md reload automatically.
Building for production
cd retrodocs
source .venv/bin/activate
# Refresh TRSE method pages from ../resources/text/ (omit if you did not change TRSE sources)
python3 scripts/import_trse_reference.py --skip-init
# Refresh bundled units list from ../units/
python3 scripts/import_trse_units.py
mkdocs build
mkdocs build may list many pages under trse/reference/methods/ as “not in nav” — that is expected: only Methods (reference) is in the sidebar; individual methods are linked from that index and searchable.
Upload the contents of retrodocs/site/ to your web server (or use deploy.sh — see below).
Editing navigation
The left sidebar and tabs come from mkdocs.yml → nav:. When you add a new page:
- Create
docs/something/new-page.md - Add an entry under
nav:inmkdocs.yml
Customising styles and templates
Styles (CSS)
- Source file:
retrodocs/docs/stylesheets/extra.css— edit this file;retrodocs/site/stylesheets/is build output only. - Registration:
mkdocs.yml→extra_css:lists stylesheets (paths are relative todocs/). Add more files there if you split CSS; order matters (later files override earlier ones). - Approach: Prefer Material’s CSS variables so theme upgrades stay predictable. This site uses
primary: custom/accent: custominmkdocs.yml; the[data-md-color-primary="custom"]and[data-md-color-accent="custom"]rules inextra.cssdefine those colours. - Colour scheme: The site uses
palette.scheme: slateonly (no light/dark toggle). Custom CSS should target[data-md-color-scheme="slate"]; rules fordefault(light) are unused unless you reintroduce a light palette. - Theme-only options: Favicon and logo are set under
theme:inmkdocs.yml(favicon,logo). Shared links and icons can also live underextra:(this project useshomepage,social).
Templates (HTML / layout)
Material uses Jinja2. To change structure (extra regions in the layout, inject scripts in <head>, replace a partial), use template overrides:
- Create a folder for overrides (common name:
overrides/next tomkdocs.yml, ordocs/overrides/). - In
mkdocs.yml, undertheme:, setcustom_dir:to that folder relative tomkdocs.yml— e.g.custom_dir: overridesif the folder isretrodocs/overrides/, orcustom_dir: docs/overridesif it lives underdocs/. - Copy only the partials you need from the theme, keeping the same path inside
custom_dirthat Material expects. Start from Material — Customization → Template overrides for the file layout. - Often you add a
main.htmlthat does{% extends "base.html" %}and overrides specific{% block ... %}blocks, instead of forking the entire theme. - Rebuild with
mkdocs buildormkdocs serveand verify the generated HTML if something does not appear (wrong partial path or block name).
Upstream reference: MkDocs Material — Customization.
What to use when
| Goal | Where to work |
|---|---|
| Colours, spacing, typography, borders | docs/stylesheets/extra.css + Material CSS variables |
| Favicon, default logo | mkdocs.yml → theme: |
Extra markup in header/footer, analytics, <head> tweaks |
custom_dir + main.html or the relevant partial under partials/ |
TRSE auto-generated help
TRSE’s IDE help lives in the parent repo (resources/text/...). This MkDocs tree is hand-written unless you add a generator script. See trse/help-import.md for the recommended approach.
Deployment options
| Method | Notes |
|---|---|
deploy.sh (rsync over SSH) |
Good for a VPS you control; see script header for env vars. |
| GitHub Actions + Pages | Build mkdocs build in CI, publish site/. |
| Cloudflare Pages / Netlify | Point at repo; build command mkdocs build, publish directory retrodocs/site. |
| CloudPanel (VPS) — static site | Create the site as Static / HTML, document root = directory containing index.html from mkdocs build. Do not use an application template that proxy_passes to a port — MkDocs output has no backend; a proxy causes 502. Upload/rsync the contents of retrodocs/site/ into that directory. |
mkdocs.yml sets site_url: https://docs.retrogamecoders.com/ so the built site knows its public URL (sitemap, etc.).
Files worth knowing
| Path | Purpose |
|---|---|
retrodocs/mkdocs.yml |
Site name, theme (custom_dir: overrides, theme.favicon from main site), plugins, nav, extra_css, social links |
retrodocs/docs/stylesheets/extra.css |
Brand colours (navy + gold) to match retrogamecoders.com; primary place for CSS — see Customising styles and templates |
retrodocs/overrides/main.html |
Extends Material base.html; favicon / PWA links + Open Graph / Twitter image (docs/images/og-image.jpg → /images/og-image.jpg) |
retrodocs/docs/images/og-image.jpg |
Social preview image (og:image, twitter:image); referenced via site_url in overrides/main.html |
retrodocs/docs/ |
Markdown: ide/, trse/, assembly/, c/, basic/, … |
retrodocs/docs/basic/rgc-basic/ |
Hand-written multi-page guide for RGC BASIC (not generated) |
retrodocs/requirements.txt |
Pinned MkDocs Material (adjust upper bound when upgrading) |
retrodocs/deploy.sh |
SSH/rsync deploy; sets DEPLOY_CACHE_BUST so built pages use extra.css?v=… (avoids stale CDN/browser CSS without relying on purges) |
retrodocs/scripts/import_trse_units.py |
Generates trse/reference/units-index.md and trse/reference/units/*.md from ../units/**/*.tru (signatures + block-comment notes) |
retrodocs/scripts/tru_extract.py |
Parses .tru text for procedure / function declarations (helper for import_trse_units.py) |
retrodocs/README.md |
Short pointer (duplicate of this file in spirit) |
retrodocs/STANDALONE_REPO.md |
Splitting retrodocs into its own GitHub repo; TRSE_REPO_ROOT, subtree split |
retrodocs/.github/workflows/ci.yml |
GitHub Actions: clone omiq/trse, run import scripts, mkdocs build --strict, upload site-html artifact |
Troubleshooting
mkdocs: command not found— Activate the venv or usepython -m mkdocs build.- Search not updating — Run a clean build:
rm -rf site && mkdocs build. - Theme looks wrong — Check
mkdocs.ymltheme:block; upstream Material docs list breaking changes per major version. - CSS edits never show (even after hard refresh) —
mkdocs servebuilds into a temporary folder, notretrodocs/site/. The browser only sees what the last rebuild copied; refreshing cannot pick up newextra.cssuntil the server rebuilds. After saving, the terminal should printDetected file changesthenReloading browsers. Usehttp://127.0.0.1:8000— notfile://orsite/on disk.hooks.pyaddsrealpathwatches,mkdocs.ymlwatch:, and?v=cache-bust while serving.start.shrunsscripts/touch_mkdocs_on_css_save.pyin the background: it pollsdocs/stylesheets/andtouchesmkdocs.ymlwhen anything changes there, so MkDocs’ config watcher always triggers a rebuild even if native file events miss your editor’s save.
Red “MkDocs 2.0” warning when you run mkdocs serve
Material for MkDocs may print a warning box about MkDocs 2.0 (breaking changes, plugins, etc.). That is not a failure — your server still starts and the site builds. It is a heads-up from the Material maintainers about the future upstream MkDocs major release.
This project intentionally pins mkdocs to 1.x in requirements.txt (mkdocs>=1.5,<2) so you stay on the stable stack until there is a clear upgrade path. You can ignore the banner for day-to-day work, or read their analysis: MkDocs 2.0 — Material blog.
Last updated: added Customising styles and templates (MkDocs Material CSS + custom_dir overrides).