Skip to content

MDX & Starlight Cheatsheet

This page acts as a reference for writing documentation. It covers standard Markdown, MDX features, and Starlight specific components.


Use these to highlight critical information. You do not need to import anything to use these.

Syntax:

:::note
**General Info:** Useful context or non-critical information.
:::
:::tip
**Pro Tip:** Helpful advice or shortcuts.
:::
:::caution
**Warning:** Be careful when doing this.
:::
:::danger
**Critical:** This action can break things or cause data loss.
:::

Result:

You can override the default title of any admonition.

Syntax:

:::tip[Did you know?]
You can customize the title of these boxes!
:::

Result:


Starlight uses Expressive Code by default.

Syntax:

```php title="app/Models/User.php"
<?php
namespace App\Models;
class User extends Authenticatable
{
// ...
}
```

Result:

app/Models/User.php
<?php
namespace App\Models;
class User extends Authenticatable
{
// ...
}

Use {RANGE} to highlight specific lines.

Syntax:

```js {2-3}
export default defineConfig({
title: 'My Docs',
social: {
github: 'https://github.com',
},
});
```

Result:

export default defineConfig({
title: 'My Docs',
social: {
github: 'https://github.com',
},
});

Use + or - at the start of a line to show changes (great for tutorials).

Syntax:

```js
function add(a, b) {
- return a - b;
+ return a + b;
}
```

Result:

function add(a, b) {
- return a - b;
+ return a + b;
}

Useful for showing instructions for different operating systems or package managers.

Syntax:

<Tabs>
<TabItem label="NPM" icon="seti:npm">
{/* ```bash
npm install astro
``` */}
</TabItem>
<TabItem label="Composer" icon="seti:php">
{/* ```bash
composer require laravel/framework
``` */}
</TabItem>
</Tabs>
// Code commented to prevent MDX from breaking

Result:

Terminal window
npm install astro

Use the <Steps> component to create numbered guides.

Syntax:

<Steps>
1. **Clone the Repo**
Run `git clone ...`
2. **Install Dependencies**
Run `composer install`
3. **Profit**
Deploy to production.
</Steps>

Result:

  1. Clone the Repo Run git clone ...

  2. Install Dependencies Run composer install

  3. Profit Deploy to production.


Excellent for showing project structure or where a file is located.

Syntax:

<FileTree>
- app/
- Models/
- User.php
- Http/
- Controllers/
- ProjectController.php
- database/
- .env
</FileTree>

Result:

  • Directoryapp/
    • DirectoryModels/
      • User.php
    • DirectoryHttp/
      • DirectoryControllers/
        • ProjectController.php
  • Directorydatabase/
  • .env

Use these for landing pages or grouping links.

Syntax:

<CardGrid>
<Card title="Laravel" icon="rocket">
Standard PHP Framework.
</Card>
<Card title="React" icon="seti:react">
Frontend Library.
</Card>
</CardGrid>

Result:

Laravel

Standard PHP Framework.

React

Frontend Library.


Prominent links to other parts of the documentation.

Syntax:

<LinkCard
title="Deployment Guide"
description="Learn how to deploy to Forge."
href="/playbooks/deployment/laravel-forge"
/>

Result:


Small status indicators.

Syntax:

<Badge text="New" variant="tip" size="small" />
<Badge text="Deprecated" variant="caution" size="medium" />
<Badge text="Draft" variant="note" size="large" />

Result:

New Deprecated Draft

Just a reminder of the basics.

FeatureSyntaxResult
Bold**Bold**Bold
Italic*Italic*Italic
Link[Google](https://google.com)Google
Inline Code`code`code

Syntax:

| Syntax | Description |
| :--- | :----------- |
| Header | Title |
| Paragraph | Text |

Result:

SyntaxDescription
HeaderTitle
ParagraphText