Skip to content

Docs Site Setup

Each lexicon can include a documentation site built with Astro Starlight. The docs site lives in lexicons/<name>/docs/.

Create the docs directory structure:

Terminal window
mkdir -p lexicons/my-lexicon/docs/src/content/docs
// @ts-check
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
export default defineConfig({
base: '/chant/lexicons/my-lexicon/',
integrations: [
starlight({
title: 'My Lexicon',
sidebar: [
{ label: '← chant docs', link: '../../' },
{ label: 'Overview', slug: 'index' },
{ label: 'Getting Started', slug: 'getting-started' },
// ... add more pages
],
}),
],
});
{
"name": "@intentius/chant-lexicon-my-lexicon-docs",
"type": "module",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview"
},
"dependencies": {
"@astrojs/starlight": "^0.37.6",
"astro": "^5.6.1",
"sharp": "^0.34.2"
}
}
{
"extends": "astro/tsconfigs/strict",
"include": [".astro/types.d.ts", "**/*"],
"exclude": ["dist"]
}

A comprehensive docs site should have these pages (as MDX files in docs/src/content/docs/):

PageFileDescription
Overviewindex.mdxInstallation, quick start, feature list
Getting Startedgetting-started.mdxFirst project walkthrough
Resourcesresources.mdxResource types, resource-level fields
Intrinsicsintrinsics.mdxTemplate functions (if applicable)
Pseudo-Parameterspseudo-parameters.mdxDeployment-time parameters
Compositescomposites.mdxAll composites with examples
Parameters & Outputsparameters-outputs.mdxTemplate parameters and outputs
Lint Ruleslint-rules.mdxAll pre-synth and post-synth checks
Importingimporting.mdxImport existing templates
Advanced Patternslinked-templates.mdxAdvanced usage patterns
Examplesexamples.mdxWalkthrough of example projects
Terminal window
# Development server
cd lexicons/my-lexicon/docs
bun install
bun run dev
# Production build
bun run build

Add a docs script to your lexicon’s package.json:

{
"scripts": {
"docs": "bun src/codegen/docs-cli.ts",
"docs:dev": "cd docs && bun run dev",
"docs:build": "cd docs && bun run build"
}
}

Each MDX page requires YAML frontmatter:

---
title: "Page Title"
description: "Brief description for SEO and sidebar"
---
Content goes here...
  • K8s docs: lexicons/k8s/docs/ — 11 pages with full sidebar navigation
  • Azure docs: lexicons/azure/docs/ — 11 pages covering ARM templates