@astrojs/starlight 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/components/Icons.ts +2 -0
- package/components/LastUpdated.astro +1 -1
- package/index.ts +7 -6
- package/integrations/asides.ts +4 -2
- package/integrations/code-rtl-support.ts +1 -1
- package/package.json +17 -15
- package/schemas/social.ts +2 -0
- package/translations/nl.json +3 -3
- package/translations/ru.json +1 -1
- package/user-components/rehype-tabs.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.15.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1238](https://github.com/withastro/starlight/pull/1238) [`02a808e`](https://github.com/withastro/starlight/commit/02a808e4a0b9ac2383576e3495f6a766b663d773) Thanks [@delucis](https://github.com/delucis)! - Add support for Astro v4, drop support for Astro v3
|
|
8
|
+
|
|
9
|
+
⚠️ **BREAKING CHANGE** Astro v3 is no longer supported. Make sure you [update Astro](https://docs.astro.build/en/guides/upgrade-to/v4/) and any other integrations at the same time as updating Starlight.
|
|
10
|
+
|
|
11
|
+
Use the new `@astrojs/upgrade` command to upgrade Astro and Starlight together:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npx @astrojs/upgrade
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- [#1242](https://github.com/withastro/starlight/pull/1242) [`d8fc9e1`](https://github.com/withastro/starlight/commit/d8fc9e15bd2ae4c945b5a3856a6ce3b5629e8b29) Thanks [@delucis](https://github.com/delucis)! - Enables link prefetching on hover by default
|
|
18
|
+
|
|
19
|
+
Astro v4’s [prefetch](https://docs.astro.build/en/guides/prefetch) support is now enabled by default. If `prefetch` is not set in `astro.config.mjs`, Starlight will use `prefetch: { prefetchAll: true, defaultStrategy: 'hover' }` by default.
|
|
20
|
+
|
|
21
|
+
If you want to preserve previous behaviour, disable link prefetching in `astro.config.mjs`:
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import { defineConfig } from 'astro/config';
|
|
25
|
+
import starlight from '@astrojs/starlight';
|
|
26
|
+
|
|
27
|
+
export default defineConfig({
|
|
28
|
+
// Disable link prefetching:
|
|
29
|
+
prefetch: false,
|
|
30
|
+
|
|
31
|
+
integrations: [
|
|
32
|
+
starlight({
|
|
33
|
+
// ...
|
|
34
|
+
}),
|
|
35
|
+
],
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- [#1226](https://github.com/withastro/starlight/pull/1226) [`909afa2`](https://github.com/withastro/starlight/commit/909afa2d468099e237bfbd25eda56270b7b00082) Thanks [@tlandmangh](https://github.com/tlandmangh)! - Add Dutch translations of default aside labels
|
|
42
|
+
|
|
43
|
+
- [#1243](https://github.com/withastro/starlight/pull/1243) [`ee234eb`](https://github.com/withastro/starlight/commit/ee234ebddcba8d07e2c879f33e38631c8955ffcf) Thanks [@khajimatov](https://github.com/khajimatov)! - Fix typo in Russian untranslated content notice
|
|
44
|
+
|
|
45
|
+
- [#1170](https://github.com/withastro/starlight/pull/1170) [`bcc2301`](https://github.com/withastro/starlight/commit/bcc2301c06796edec3923c666078e82eaf5a1990) Thanks [@tmcw](https://github.com/tmcw)! - Fix timezone-reliance in LastUpdated
|
|
46
|
+
|
|
47
|
+
- [#1203](https://github.com/withastro/starlight/pull/1203) [`4601449`](https://github.com/withastro/starlight/commit/4601449894bbbd619e4149788113090b67697fe1) Thanks [@orhun](https://github.com/orhun)! - Adds Matrix social link icon
|
|
48
|
+
|
|
3
49
|
## 0.14.0
|
|
4
50
|
|
|
5
51
|
### Minor Changes
|
package/components/Icons.ts
CHANGED
|
@@ -101,4 +101,6 @@ export const Icons = {
|
|
|
101
101
|
'<path d="M22.04 7.6c0-2.8-2.19-5.1-4.75-5.93a15.19 15.19 0 0 0-10.44.55C3.16 3.96 2 7.78 1.95 11.58c-.02 3.12.3 11.36 4.94 11.42 3.45.04 3.97-4.4 5.56-6.55 1.14-1.52 2.6-1.95 4.4-2.4 3.1-.76 5.2-3.2 5.2-6.44Z"/>',
|
|
102
102
|
slack:
|
|
103
103
|
'<path d="M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52Zm1.271 0a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313ZM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834Zm0 1.271a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312Zm10.122 2.521a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834Zm-1.268 0a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312Zm-2.523 10.122a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52Zm0-1.268a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313Z"/>',
|
|
104
|
+
matrix:
|
|
105
|
+
'<path d="M22.5 1.5v21h-2.25V24H24V0h-3.75v1.5h2.25ZM7.46 7.95V9.1h.04a3.02 3.02 0 0 1 2.61-1.39c.54 0 1.03.1 1.48.32.44.2.78.58 1.01 1.1.26-.37.6-.7 1.03-.99.44-.28.95-.43 1.55-.43.45 0 .87.06 1.26.17.38.11.71.29.99.53.27.24.49.56.64.95.15.4.23.86.23 1.42v5.72h-2.34v-4.85c0-.29-.01-.56-.04-.8a1.73 1.73 0 0 0-.18-.67 1.1 1.1 0 0 0-.44-.45 1.6 1.6 0 0 0-.78-.16c-.33 0-.6.06-.8.19-.2.12-.37.29-.48.5a2 2 0 0 0-.23.69c-.04.26-.06.52-.06.78v4.77H10.6v-4.8l-.01-.75a2.29 2.29 0 0 0-.14-.69c-.08-.2-.23-.38-.42-.5a1.5 1.5 0 0 0-.85-.2c-.15.01-.3.04-.44.08-.19.06-.37.15-.52.28-.18.14-.32.34-.44.6-.12.26-.18.6-.18 1.02v4.96H5.25V7.94h2.21ZM1.5 1.5v21h2.25V24H0V0h3.75v1.5H1.5Z"/>',
|
|
104
106
|
};
|
|
@@ -9,7 +9,7 @@ const { labels, lang, lastUpdated } = Astro.props;
|
|
|
9
9
|
<p>
|
|
10
10
|
{labels['page.lastUpdated']}{' '}
|
|
11
11
|
<time datetime={lastUpdated.toISOString()}>
|
|
12
|
-
{lastUpdated.toLocaleDateString(lang, { dateStyle: 'medium' })}
|
|
12
|
+
{lastUpdated.toLocaleDateString(lang, { dateStyle: 'medium', timeZone: 'UTC' })}
|
|
13
13
|
</time>
|
|
14
14
|
</p>
|
|
15
15
|
)
|
package/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import mdx from '@astrojs/mdx';
|
|
2
|
-
import type { AstroIntegration
|
|
2
|
+
import type { AstroIntegration } from 'astro';
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
4
|
import { dirname, relative } from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
@@ -41,11 +41,11 @@ export default function StarlightIntegration({
|
|
|
41
41
|
|
|
42
42
|
injectRoute({
|
|
43
43
|
pattern: '404',
|
|
44
|
-
|
|
44
|
+
entrypoint: '@astrojs/starlight/404.astro',
|
|
45
45
|
});
|
|
46
46
|
injectRoute({
|
|
47
47
|
pattern: '[...slug]',
|
|
48
|
-
|
|
48
|
+
entrypoint: '@astrojs/starlight/index.astro',
|
|
49
49
|
});
|
|
50
50
|
// Add built-in integrations only if they are not already added by the user through the
|
|
51
51
|
// config or by a plugin.
|
|
@@ -61,7 +61,7 @@ export default function StarlightIntegration({
|
|
|
61
61
|
if (!allIntegrations.find(({ name }) => name === '@astrojs/mdx')) {
|
|
62
62
|
integrations.push(mdx());
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
updateConfig({
|
|
65
65
|
integrations,
|
|
66
66
|
vite: {
|
|
67
67
|
plugins: [vitePluginStarlightUserConfig(starlightConfig, config)],
|
|
@@ -76,8 +76,9 @@ export default function StarlightIntegration({
|
|
|
76
76
|
config.markdown.shikiConfig.theme !== 'github-dark' ? {} : { theme: 'css-variables' },
|
|
77
77
|
},
|
|
78
78
|
scopedStyleStrategy: 'where',
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
// If not already configured, default to prefetching all links on hover.
|
|
80
|
+
prefetch: config.prefetch ?? { prefetchAll: true },
|
|
81
|
+
});
|
|
81
82
|
},
|
|
82
83
|
|
|
83
84
|
'astro:build:done': ({ dir }) => {
|
package/integrations/asides.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="mdast-util-directive" />
|
|
2
|
+
|
|
1
3
|
import type { AstroConfig, AstroUserConfig } from 'astro';
|
|
2
4
|
import { h as _h, s as _s, type Properties } from 'hastscript';
|
|
3
5
|
import type { Paragraph as P, Root } from 'mdast';
|
|
@@ -100,7 +102,7 @@ function remarkAsides(options: AsidesOptions): Plugin<[], Root> {
|
|
|
100
102
|
const locale = pathToLocale(file.history[0], options);
|
|
101
103
|
const t = options.useTranslations(locale);
|
|
102
104
|
visit(tree, (node, index, parent) => {
|
|
103
|
-
if (!parent || index ===
|
|
105
|
+
if (!parent || index === undefined || node.type !== 'containerDirective') {
|
|
104
106
|
return;
|
|
105
107
|
}
|
|
106
108
|
const variant = node.name;
|
|
@@ -112,7 +114,7 @@ function remarkAsides(options: AsidesOptions): Plugin<[], Root> {
|
|
|
112
114
|
// title prop, and remove the paragraph from children.
|
|
113
115
|
let title = t(`aside.${variant}`);
|
|
114
116
|
remove(node, (child): boolean | void => {
|
|
115
|
-
if (child.data
|
|
117
|
+
if (child.data && 'directiveLabel' in child.data && child.data.directiveLabel) {
|
|
116
118
|
if (
|
|
117
119
|
'children' in child &&
|
|
118
120
|
Array.isArray(child.children) &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/starlight",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Build beautiful, high-performance documentation websites with Astro",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -159,32 +159,34 @@
|
|
|
159
159
|
"./style/markdown.css": "./style/markdown.css"
|
|
160
160
|
},
|
|
161
161
|
"peerDependencies": {
|
|
162
|
-
"astro": "^
|
|
162
|
+
"astro": "^4.0.0"
|
|
163
163
|
},
|
|
164
164
|
"devDependencies": {
|
|
165
|
-
"@astrojs/markdown-remark": "^
|
|
165
|
+
"@astrojs/markdown-remark": "^4.0.0",
|
|
166
166
|
"@types/node": "^18.16.19",
|
|
167
167
|
"@vitest/coverage-v8": "^0.33.0",
|
|
168
|
-
"astro": "^
|
|
168
|
+
"astro": "^4.0.1",
|
|
169
169
|
"vitest": "^0.33.0"
|
|
170
170
|
},
|
|
171
171
|
"dependencies": {
|
|
172
|
-
"@astrojs/mdx": "^
|
|
172
|
+
"@astrojs/mdx": "^2.0.0",
|
|
173
173
|
"@astrojs/sitemap": "^3.0.3",
|
|
174
174
|
"@pagefind/default-ui": "^1.0.3",
|
|
175
|
-
"@types/
|
|
176
|
-
"
|
|
175
|
+
"@types/hast": "^3.0.3",
|
|
176
|
+
"@types/mdast": "^4.0.3",
|
|
177
|
+
"astro-expressive-code": "^0.29.3",
|
|
177
178
|
"bcp-47": "^2.1.0",
|
|
178
179
|
"execa": "^8.0.1",
|
|
179
|
-
"hast-util-select": "^
|
|
180
|
-
"hastscript": "^
|
|
180
|
+
"hast-util-select": "^6.0.2",
|
|
181
|
+
"hastscript": "^8.0.0",
|
|
182
|
+
"mdast-util-directive": "^3.0.0",
|
|
181
183
|
"pagefind": "^1.0.3",
|
|
182
|
-
"rehype": "^
|
|
183
|
-
"remark-directive": "^
|
|
184
|
-
"unified": "^
|
|
185
|
-
"unist-util-remove": "^
|
|
186
|
-
"unist-util-visit": "^
|
|
187
|
-
"vfile": "^
|
|
184
|
+
"rehype": "^13.0.1",
|
|
185
|
+
"remark-directive": "^3.0.0",
|
|
186
|
+
"unified": "^11.0.4",
|
|
187
|
+
"unist-util-remove": "^4.0.0",
|
|
188
|
+
"unist-util-visit": "^5.0.0",
|
|
189
|
+
"vfile": "^6.0.1"
|
|
188
190
|
},
|
|
189
191
|
"scripts": {
|
|
190
192
|
"test": "vitest",
|
package/schemas/social.ts
CHANGED
|
@@ -25,6 +25,7 @@ export const socialLinks = [
|
|
|
25
25
|
'reddit',
|
|
26
26
|
'patreon',
|
|
27
27
|
'slack',
|
|
28
|
+
'matrix',
|
|
28
29
|
] as const;
|
|
29
30
|
|
|
30
31
|
export const SocialLinksSchema = () =>
|
|
@@ -65,6 +66,7 @@ export const SocialLinksSchema = () =>
|
|
|
65
66
|
reddit: 'Reddit',
|
|
66
67
|
patreon: 'Patreon',
|
|
67
68
|
slack: 'Slack',
|
|
69
|
+
matrix: 'Matrix',
|
|
68
70
|
}[key];
|
|
69
71
|
labelledLinks[key] = { label, url };
|
|
70
72
|
}
|
package/translations/nl.json
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"page.previousLink": "Vorige",
|
|
20
20
|
"page.nextLink": "Volgende",
|
|
21
21
|
"404.text": "Pagina niet gevonden. Controleer de URL of probeer de zoekbalk.",
|
|
22
|
-
"aside.note": "
|
|
22
|
+
"aside.note": "Opmerking",
|
|
23
23
|
"aside.tip": "Tip",
|
|
24
|
-
"aside.caution": "
|
|
25
|
-
"aside.danger": "
|
|
24
|
+
"aside.caution": "Opgepast",
|
|
25
|
+
"aside.danger": "Gevaar"
|
|
26
26
|
}
|
package/translations/ru.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"sidebarNav.accessibleLabel": "Основное",
|
|
14
14
|
"tableOfContents.onThisPage": "На этой странице",
|
|
15
15
|
"tableOfContents.overview": "Обзор",
|
|
16
|
-
"i18n.untranslatedContent": "
|
|
16
|
+
"i18n.untranslatedContent": "Это содержимое пока не доступно на вашем языке.",
|
|
17
17
|
"page.editLink": "Редактировать страницу",
|
|
18
18
|
"page.lastUpdated": "Последнее обновление:",
|
|
19
19
|
"page.previousLink": "Предыдущая",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Element } from 'hast';
|
|
1
2
|
import { select } from 'hast-util-select';
|
|
2
3
|
import { rehype } from 'rehype';
|
|
3
4
|
import { CONTINUE, SKIP, visit } from 'unist-util-visit';
|
|
@@ -50,7 +51,7 @@ const getIDs = () => {
|
|
|
50
51
|
const tabsProcessor = rehype()
|
|
51
52
|
.data('settings', { fragment: true })
|
|
52
53
|
.use(function tabs() {
|
|
53
|
-
return (tree, file) => {
|
|
54
|
+
return (tree: Element, file) => {
|
|
54
55
|
file.data.panels = [];
|
|
55
56
|
let isFirst = true;
|
|
56
57
|
visit(tree, 'element', (node) => {
|