Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
11 changes: 11 additions & 0 deletions .changeset/satteri-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@astrojs/starlight': minor
---

⚠️ **BREAKING CHANGE:** The minimum supported version of Astro is now 6.4.0.

Please update Starlight and Astro together:

```sh
npx @astrojs/upgrade
```
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 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