Contributing & Editing Documentation
Strata’s website (strata-ml.dev) is built with Astro Starlight in website/, fed by handwritten Markdown guides and auto-generated API reference pages extracted from Mojo docstrings by scripts/generate_docs.py.
1. Repository Layout: Hand-Edited vs. Auto-Generated
Section titled “1. Repository Layout: Hand-Edited vs. Auto-Generated”| Path | Maintained By | Purpose |
|---|---|---|
website/src/content/docs/tutorials/ |
Hand-edited | Step-by-step lessons (auto-added to sidebar) |
website/src/content/docs/how-to/ |
Hand-edited | Task-oriented recipes & guides (auto-added to sidebar) |
website/src/content/docs/explanation/ |
Hand-edited | Architecture & algorithm deep dives (shown under Concepts in sidebar) |
website/src/content/docs/index.mdx |
Hand-edited | Landing page wrapper |
website/src/components/HomePage.astro |
Hand-edited | Homepage sections, benchmarks, & module grid |
website/src/styles/custom.css |
Hand-edited | Obsidian / Flame-Orange theme & homepage CSS |
website/src/content/docs/reference/ |
Auto-generated (gitignored) | Per-module & per-symbol API docs from Mojo source |
website/src/data/site-meta.json |
Auto-generated (gitignored) | Version, symbol counts, & module cards for the homepage |
website/dist/ |
Build output (gitignored) | Final static HTML, Pagefind search index, & sitemap |
2. Adding or Editing Handwritten Guides
Section titled “2. Adding or Editing Handwritten Guides”Tutorials, How-To guides, and Concepts require no Python script changes:
- Create or edit a
.md(or.mdx) file insidewebsite/src/content/docs/tutorials/,how-to/, orexplanation/. - Add Starlight YAML frontmatter at the top of the file:
---title: Your Page Titledescription: Concise one-sentence summary for search & SEO.sidebar: order: 6---- Start the body directly with
## 1. Section(avoid repeating the top# Title, since Starlight renderstitleas the page heading). - Use root-relative links when cross-referencing other pages (e.g.,
/reference/core/,/how-to/model_persistence/,/explanation/benchmarks/). - Use standard LaTeX math (
$...$inline and$$...$$display) and:::note/:::tip/:::cautioncallout blocks.
Starlight automatically updates the sidebar navigation, Pagefind full-text search index, and sitemap-index.xml.
3. Documenting New Mojo Estimators & Modules
Section titled “3. Documenting New Mojo Estimators & Modules”API reference pages are generated directly from docstrings in strata/:
- Write Google-style docstrings in your
.mojofile (Parameters:,Args:,Attributes:,Returns:,Raises:,Examples:). Put private helper structs in_-prefixed files so the doc generator only emits public APIs. - Escape LaTeX backslashes inside Mojo strings (
\\sum,\\|w\\|_2) and avoid raw||bars inside descriptions (they break Markdown tables). - Register the public
.mojofile inMODULE_METADATAinsidescripts/generate_docs.py. - Regenerate the API reference Markdown:
pixi run generate-docs4. Editing the Homepage & Theme
Section titled “4. Editing the Homepage & Theme”- Content & layout: Edit
website/src/components/HomePage.astro. The version pill, total API count, and module grid update automatically fromsite-meta.jsonwhenevergenerate_docs.pyruns. - Colors & styling: Edit
website/src/styles/custom.css. - Navigation, custom domain, or head tags: Edit
website/astro.config.mjs.
5. Local Preview & CI Deployment
Section titled “5. Local Preview & CI Deployment”Starlight uses a dedicated Pixi docs environment (nodejs 22.x LTS) so default Mojo development environments stay fast and lightweight.
# First-time setup: install npm dependencies in website/pixi run -e docs website-install
# Generate API reference Markdown and start hot-reloading dev serverpixi run -e docs serve-docs
# Run full production build (outputs website/dist/)pixi run -e docs build-docsOn every pull request, GitHub Actions runs pixi run generate-docs and astro build to verify zero broken Markdown, KaTeX, or internal links. Merges to main automatically deploy to https://strata-ml.dev via GitHub Pages (with legacy #hash URLs automatically redirected to their new routes).