Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .changeset/satteri-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
'@astrojs/starlight': minor
---

Adds support for Astro 6.4 and the new Sätteri Markdown processor.

It is now possible to opt-into using [Astro's 6.4 Sätteri Markdown processor](https://astro.build/blog/astro-640/#faster-markdown-builds-with-s%C3%A4tteri) by installing the `@astrojs/markdown-satteri` package and configuring it in your `astro.config.mjs` file:

```js
// astro.config.mjs

import { defineConfig } from 'astro/config';
import { satteri } from '@astrojs/markdown-satteri';

export default defineConfig({
markdown: {
processor: satteri(),
},
});
Comment thread
Princesseuh marked this conversation as resolved.
Outdated
```
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@astrojs/starlight": "workspace:*",
"@lunariajs/core": "^0.1.1",
"@types/culori": "^4.0.1",
"astro": "^6.3.1",
"astro": "^6.4.0",
"culori": "^4.0.2",
"sharp": "^0.34.5"
},
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/guides/authoring-content.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ Starlight supports all other Markdown authoring syntax, such as lists and tables

## Advanced Markdown and MDX configuration

Starlight uses Astro’s Markdown and MDX renderer built on remark and rehype. You can add support for custom syntax and behavior by adding `remarkPlugins` or `rehypePlugins` in your Astro config file. See [“Markdown Plugins”](https://docs.astro.build/en/guides/markdown-content/#markdown-plugins) in the Astro docs to learn more.
Starlight renders Markdown and MDX using Astro’s configurable [`markdown.processor`](https://docs.astro.build/en/reference/configuration-reference/#markdownprocessor), which defaults to the remark and rehype-based `unified()` processor. You can add support for custom syntax and behavior by passing plugins and options to your configured processor. See [“Markdown Plugins”](https://docs.astro.build/en/guides/markdown-content/#markdown-plugins) in the Astro docs to learn more.

## Markdoc

Expand Down
2 changes: 1 addition & 1 deletion examples/basics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/starlight": "^0.39.3",
"astro": "^6.3.1",
"astro": "^6.4.0",
"sharp": "^0.34.5"
}
}
2 changes: 1 addition & 1 deletion examples/markdoc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@astrojs/markdoc": "^1.0.4",
"@astrojs/starlight": "^0.39.3",
"@astrojs/starlight-markdoc": "^0.6.0",
"astro": "^6.3.1",
"astro": "^6.4.0",
"sharp": "^0.34.5"
}
}
2 changes: 1 addition & 1 deletion examples/tailwind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@astrojs/starlight": "^0.39.3",
"@astrojs/starlight-tailwind": "^5.0.0",
"@tailwindcss/vite": "^4.2.4",
"astro": "^6.3.1",
"astro": "^6.4.0",
"sharp": "^0.34.5",
"tailwindcss": "^4.2.4"
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@changesets/cli": "^2.31.0",
"@eslint/js": "^10.0.1",
"@size-limit/file": "^12.1.0",
"astro": "^6.3.1",
"astro": "^6.4.0",
"eslint": "^10.3.0",
"eslint-config-prettier": "^10.1.8",
"globals": "^17.6.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/starlight/__e2e__/fixtures/basics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/starlight": "workspace:*",
"astro": "^6.3.1"
"astro": "^6.4.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/starlight": "workspace:*",
"astro": "^6.3.1"
"astro": "^6.4.0"
}
}
2 changes: 1 addition & 1 deletion packages/starlight/__e2e__/fixtures/git/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/starlight": "workspace:*",
"astro": "^6.3.1"
"astro": "^6.4.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/starlight": "workspace:*",
"astro": "^6.3.1"
"astro": "^6.4.0"
}
}
2 changes: 1 addition & 1 deletion packages/starlight/__e2e__/fixtures/ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"dependencies": {
"@astrojs/node": "^10.1.0",
"@astrojs/starlight": "workspace:*",
"astro": "^6.3.1"
"astro": "^6.4.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { expect, test } from 'vitest';
import type { StarlightUserConfig } from '../../utils/user-config';
import {
createStarlightMarkdownProcessor,
describeEachProcessor,
docFileURL,
nonDocFileURL,
} from './utils';

const starlightConfig = {
title: 'Anchor Links Tests',
locales: { en: { label: 'English' }, fr: { label: 'French' } },
defaultLocale: 'en',
} satisfies StarlightUserConfig;

describeEachProcessor(
'anchor links',
(ctx, name) => {
test('generates anchor link markup', async () => {
const res = await ctx().render(`\n## Some text\n`);
await expect(res.code).toMatchFileSnapshot(
ctx().snapshot('generates-anchor-link-markup.html')
);
});

test('generates an accessible link label', async () => {
const res = await ctx().render(`\n## Some text\n`);
expect(res.code).includes('class="sl-anchor-link"');
expect(res.code).includes('Section titled “Some text”');
});

test('strips HTML markup in the accessible link label', async () => {
const res = await ctx().render(`\n## Some _important nested \`HTML\`_\n`);
// The heading itself keeps the rendered markup (inline code gets `dir="auto"`).
expect(res.code).includes('Some <em>important nested <code dir="auto">HTML</code></em>');
// The visually-hidden label is plain text.
expect(res.code).includes('Section titled “Some important nested HTML”');
});

test('localizes the accessible label for the file’s language', async () => {
const res = await ctx().render(`\n## Some text\n`, { fileURL: docFileURL('fr/index.md') });
expect(res.code).includes('Section intitulée « Some text »');
});

test('records the heading id in metadata', async () => {
const res = await ctx().render(`\n## Some text\n`);
expect(res.metadata.headings).toEqual([{ depth: 2, slug: 'some-text', text: 'Some text' }]);
});

test('disables wrapping when `headingLinks: false`', async () => {
const off = await createStarlightMarkdownProcessor(name, {
...starlightConfig,
markdown: { headingLinks: false },
});
const res = await ctx().render(`\n## Some text\n`, { processor: off });
expect(res.code).not.includes('sl-heading-wrapper');
expect(res.code).not.includes('sl-anchor-link');
});

test('skips files outside the docs collection', async () => {
const res = await ctx().render(`\n## Some text\n`, { fileURL: nonDocFileURL() });
expect(res.code).not.includes('sl-heading-wrapper');
expect(res.code).not.includes('sl-anchor-link');
});
},
{ config: starlightConfig }
);
Loading
Loading