Skip to content

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

Tutorials, How-To guides, and Concepts require no Python script changes:

  1. Create or edit a .md (or .mdx) file inside website/src/content/docs/tutorials/, how-to/, or explanation/.
  2. Add Starlight YAML frontmatter at the top of the file:
---
title: Your Page Title
description: Concise one-sentence summary for search & SEO.
sidebar:
order: 6
---
  1. Start the body directly with ## 1. Section (avoid repeating the top # Title, since Starlight renders title as the page heading).
  2. Use root-relative links when cross-referencing other pages (e.g., /reference/core/, /how-to/model_persistence/, /explanation/benchmarks/).
  3. Use standard LaTeX math ($...$ inline and $$...$$ display) and :::note / :::tip / :::caution callout 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/:

  1. Write Google-style docstrings in your .mojo file (Parameters:, Args:, Attributes:, Returns:, Raises:, Examples:). Put private helper structs in _-prefixed files so the doc generator only emits public APIs.
  2. Escape LaTeX backslashes inside Mojo strings (\\sum, \\|w\\|_2) and avoid raw || bars inside descriptions (they break Markdown tables).
  3. Register the public .mojo file in MODULE_METADATA inside scripts/generate_docs.py.
  4. Regenerate the API reference Markdown:
Terminal window
pixi run generate-docs


Starlight uses a dedicated Pixi docs environment (nodejs 22.x LTS) so default Mojo development environments stay fast and lightweight.

Terminal window
# First-time setup: install npm dependencies in website/
pixi run -e docs website-install
# Generate API reference Markdown and start hot-reloading dev server
pixi run -e docs serve-docs
# Run full production build (outputs website/dist/)
pixi run -e docs build-docs

On 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).