Docs site publishing
Pi Hindsight publishes the Astro/Starlight documentation site to GitHub Pages from GitHub Actions.
Published URL: https://luxus.github.io/pi-hindsight/
Local preview
Section titled “Local preview”Install dependencies and run the local dev server:
npm installnpm run docs:devBuild and verify the same docs checks used by CI:
npm run docs:checkdocs:check verifies generated surface-reference freshness, generated code-map freshness, internal docs links/sidebar routes, packaged Markdown links, GitHub Pages base-prefixed docs links, and docs-site build.
GitHub Pages path
Section titled “GitHub Pages path”The site is configured for the repository project path in astro.config.mjs:
site: "https://luxus.github.io/pi-hindsight",base: "/pi-hindsight",Keep base set to /pi-hindsight unless the repository moves to a root-domain Pages deployment. This makes absolute docs links and built assets work under GitHub Pages project hosting.
Mermaid rendering pipeline
Section titled “Mermaid rendering pipeline”Pi Hindsight uses astro-mermaid for Mermaid diagrams.
The pipeline is hybrid:
-
Markdown source keeps normal fenced blocks:
```mermaidflowchart LRA --> B``` -
During
astro build,astro-mermaidruns Remark/Rehype transforms before Starlight. Those transforms convert Mermaid fences into<pre class="mermaid">blocks. -
The built HTML still contains
<pre class="mermaid">. This is expected. SVG is not generated at build time. -
In the browser, the client-side Mermaid runtime renders each
<pre class="mermaid">into SVG. -
Theme changes and Astro view transitions re-render diagrams client-side.
Implementation expectations:
- Keep
mermaid()beforestarlight()inastro.config.mjs. - Keep
mermaidinstalled because the browser runtime imports it. - Keep
@mermaid-js/layout-elkinstalled when diagrams use or may use ELK layout. The integration logsEnabling ELK supportwhen the optional peer is present. - Do not add a second custom Mermaid renderer unless a concrete bug proves
astro-mermaidcannot handle the needed case.
Build logs such as Remark transformed mermaid block mean the fence was prepared for client-side rendering. They do not mean build-time SVG rendering happened.
Deployment workflow
Section titled “Deployment workflow”.github/workflows/docs-pages.yml runs on pushes to main that touch docs-site inputs and on manual workflow_dispatch.
The path filter is intentionally narrow because pull requests do not publish and the normal Check workflow already runs npm run docs:check. Keep docs-site duplicates only when they are part of the published site, and include every source that can change generated or duplicated site output in the Pages path filter: docs-site/**, astro.config.mjs, package manifests, docs check/generator scripts, and this workflow. If a future PR starts generating site pages from root Markdown, add those root paths to .github/workflows/docs-pages.yml in the same PR.
The workflow:
- enables/configures GitHub Pages for the repository,
- checks out the repository,
- installs dependencies with
npm ci --engine-strict, - runs
npm run docs:check, - uploads
docs-site/dist, and - deploys the artifact to GitHub Pages.
Pull requests do not publish. PR validation comes from the normal Check workflow because npm run check includes npm run docs:check.
Troubleshooting
Section titled “Troubleshooting”- If generated docs are stale, run
npm run surface-referenceornpm run code-map, then re-runnpm run docs:check. - If Mermaid diagrams show as raw code in the browser, confirm
mermaid()appears beforestarlight()inastro.config.mjs, then check the browser console for[astro-mermaid]errors. - If built HTML contains
<pre class="mermaid">, that is normal. Verify browser rendering, not build-time SVG output. - If a docs link fails locally but works in the browser, prefer relative source links for same-section docs pages. Absolute deployed-site links must include the Pages base path.
- If deployment fails before upload, inspect the build step first; Pages deployment only receives the already-built
docs-site/distartifact. - If the deployed site has broken assets, verify
siteandbaseinastro.config.mjsstill match the GitHub Pages project URL.