Skip to content

Starlight Features Demo

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:

app.js
// This is a JavaScript example
function 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 JavaScript
const fetchData = async (url) => {
try {
const response = await fetch(url);
return await response.json();
} catch (error) {
console.error('Error:', error);
}
};
#!/bin/bash
# Deploy script
npm run build
npm run test
npm run deploy
echo "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.

  • Directorysrc/
    • Directorycomponents/
      • Header.astro
      • Footer.astro
      • Button.tsx (highlighted)
    • Directorycontent/
      • Directorydocs/
        • Directoryen/
          • getting-started.mdx
          • demo.mdx
        • Directorypl/
          • getting-started.mdx
          • demo.mdx
    • Directorypages/
      • index.astro
      • Directoryapi/
        • […slug].ts
  • package.json
  • astro.config.mjs
  • README.md (optional)
  1. Install dependencies

    Terminal window
    npm install @astrojs/starlight
  2. Configure Astro Add Starlight to your astro.config.mjs:

    import starlight from '@astrojs/starlight';
    export default {
    integrations: [starlight({
    title: 'My Docs',
    })],
    };
  3. Create content Add MDX files to src/content/en/

  4. Deploy Build and deploy your documentation site

FeatureDescriptionStatus
MDX SupportWrite content with componentsStable
i18nMulti-language supportStable
SearchBuilt-in search functionalityBeta
Dark ModeAutomatic theme switchingStable

Starlight includes many built-in icons:

GitHub Launch Favorite Documentation

And various badge styles:

Default Note Tip Caution Danger Success
Click to expand advanced configuration
// Advanced Starlight configuration
export 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}
$$
api-response.json
{
"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"
}
Dockerfile
FROM node:18-alpine
WORKDIR /app
# Copy and install dependencies
COPY package*.json ./
RUN npm ci --only=production
COPY . .
EXPOSE 3000
CMD ["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.