-
-
Notifications
You must be signed in to change notification settings - Fork 979
feat: add support for Astro 6.4 and Sätteri #3923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Princesseuh
wants to merge
23
commits into
main
Choose a base branch
from
feat/astro-640
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
e979080
feat: add support for Astro 6.4 and Sätteri
Princesseuh 434d001
fix: use official version
Princesseuh 5b36b7d
feat: use modern options
Princesseuh 1a1d225
Merge branch 'main' into feat/astro-640
Princesseuh fcada9c
fix: update mdx verison
Princesseuh 64d9aa0
feat: cleanup
Princesseuh ed51deb
feat: adjust for feedback
Princesseuh 3d8fc2f
fix: bump to latest satteri
Princesseuh 7dc2afb
Merge branch 'main' into feat/astro-640
Princesseuh c0c7400
fix: some cleanup
Princesseuh dd4ba74
fix: some more cleanup
Princesseuh 75d947d
fix: tests for satteri restoration
Princesseuh 9f358fa
feat: adjust for feedback
Princesseuh ae37020
fix: use published versions
Princesseuh 08255bd
Delete satteri-visitor-traversal-control.md
Princesseuh c94011a
fix: add test
Princesseuh 594b15f
chore: format somme comments
HiDeoo 00db0f5
test: tweak branches coverage for new `index.ts` code
HiDeoo ab7d5ae
chore: add link to EC issue
HiDeoo 39acec1
chore: tweak changeset
HiDeoo 27864bc
Merge branch 'main' into feat/astro-640
HiDeoo f4d7bc9
refactor: disable satteri
HiDeoo ba14d55
refactor: remove astro pre-6.4 logic
HiDeoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(), | ||
| }, | ||
| }); | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,6 @@ | |
| "private": true, | ||
| "dependencies": { | ||
| "@astrojs/starlight": "workspace:*", | ||
| "astro": "^6.3.1" | ||
| "astro": "^6.4.0" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,6 @@ | |
| "private": true, | ||
| "dependencies": { | ||
| "@astrojs/starlight": "workspace:*", | ||
| "astro": "^6.3.1" | ||
| "astro": "^6.4.0" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,6 @@ | |
| "private": true, | ||
| "dependencies": { | ||
| "@astrojs/starlight": "workspace:*", | ||
| "astro": "^6.3.1" | ||
| "astro": "^6.4.0" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,6 @@ | |
| "private": true, | ||
| "dependencies": { | ||
| "@astrojs/starlight": "workspace:*", | ||
| "astro": "^6.3.1" | ||
| "astro": "^6.4.0" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
packages/starlight/__tests__/markdown-processor/anchor-links.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 } | ||
| ); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.