Feature One
Build fast with modern tools and frameworks.
Welcome to the Starlight features demo! This page showcases all the powerful MDX components and features available in Starlight. New
Starlight provides various callout types to highlight important information:
// This is a JavaScript examplefunction greet(name) { const message = `Hello, ${name}!`; console.log(message); return message; // This line is highlighted as inserted // return null; // This line is highlighted as deleted}// Modern JavaScriptconst fetchData = async (url) => { try { const response = await fetch(url); return await response.json(); } catch (error) { console.error('Error:', error); }};// TypeScript with typesinterface User { id: number; name: string; email: string;}
const fetchData = async (url: string): Promise<User[]> => { try { const response = await fetch(url); return await response.json(); } catch (error) { console.error('Error:', error); return []; }};# Python exampleimport asyncioimport aiohttp
async def fetch_data(url: str) -> dict: async with aiohttp.ClientSession() as session: async with session.get(url) as response: return await response.json()#!/bin/bash# Deploy scriptnpm run buildnpm run testnpm run deployecho "Deployment complete!"Feature One
Build fast with modern tools and frameworks.
Feature Two
Beautiful, accessible components out of the box.
Feature Three
Write content in MDX with full component support.
Feature Four
Highly customizable with minimal configuration.
Install dependencies
npm install @astrojs/starlightConfigure Astro
Add Starlight to your astro.config.mjs:
import starlight from '@astrojs/starlight';
export default { integrations: [starlight({ title: 'My Docs', })],};Create content
Add MDX files to src/content/en/
Deploy Build and deploy your documentation site
| Feature | Description | Status |
|---|---|---|
| MDX Support | Write content with components | Stable |
| i18n | Multi-language support | Stable |
| Search | Built-in search functionality | Beta |
| Dark Mode | Automatic theme switching | Stable |
Starlight includes many built-in icons:
GitHub Launch Favorite Documentation
And various badge styles:
Default Note Tip Caution Danger Success// Advanced Starlight configurationexport default { integrations: [ starlight({ title: 'My Documentation', social: { github: 'https://github.com/yourusername/yourrepo', twitter: 'https://twitter.com/yourusername', }, sidebar: [ { label: 'Guides', autogenerate: { directory: 'guides' }, }, { label: 'Reference', autogenerate: { directory: 'reference' }, }, ], customCss: ['./src/styles/custom.css'], }), ],};Starlight can support mathematical expressions when configured:
Inline math: $E = mc^2$
Block math:
$$\frac{n!}{k!(n-k)!} = \binom{n}{k}$${ "status": "success", "data": { "users": [ { "id": 1, "name": "John Doe", "email": "john@example.com", "roles": ["admin", "developer"] } ], "pagination": { "page": 1, "limit": 10, "total": 100 } }, "timestamp": "2024-01-15T10:30:00Z"}FROM node:18-alpineWORKDIR /app# Copy and install dependenciesCOPY package*.json ./RUN npm ci --only=productionCOPY . .EXPOSE 3000CMD ["node", "server.js"]This demo showcases the power and flexibility of Starlight’s MDX capabilities. You can create rich, interactive documentation that helps developers understand and use your projects effectively.