@astrojs/starlight 0.24.3 → 0.24.5
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 +22 -0
- package/__e2e__/collection-config.test.ts +12 -0
- package/__e2e__/fixtures/custom-src-dir/astro.config.mjs +11 -0
- package/__e2e__/fixtures/custom-src-dir/node_modules/.bin/astro +17 -0
- package/__e2e__/fixtures/custom-src-dir/package.json +9 -0
- package/__e2e__/fixtures/custom-src-dir/www/content/config.ts +6 -0
- package/__e2e__/fixtures/custom-src-dir/www/env.d.ts +2 -0
- package/__e2e__/fixtures/custom-src-dir/www/pages/custom.astro +7 -0
- package/components/Select.astro +5 -2
- package/index.ts +5 -1
- package/integrations/asides.ts +41 -2
- package/integrations/virtual-user-config.ts +1 -1
- package/package.json +1 -1
- package/playwright.config.ts +1 -0
- package/translations/cs.json +14 -1
- package/translations/nb.json +5 -5
- package/translations/ru.json +1 -1
- package/user-components/Steps.astro +3 -1
- package/user-components/rehype-steps.ts +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.24.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2062](https://github.com/withastro/starlight/pull/2062) [`5ac0ac6`](https://github.com/withastro/starlight/commit/5ac0ac6614e3c45d810a1594a2009d3febfa2793) Thanks [@evadecker](https://github.com/evadecker)! - Increase theme and language select inline padding
|
|
8
|
+
|
|
9
|
+
- [#2056](https://github.com/withastro/starlight/pull/2056) [`87e9ad0`](https://github.com/withastro/starlight/commit/87e9ad029c9730fca8df66e35828b57cd0872a61) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes an issue preventing remark plugins injected by Starlight plugins to handle Markdown text and leaf directives.
|
|
10
|
+
|
|
11
|
+
- [#2063](https://github.com/withastro/starlight/pull/2063) [`3ee1a94`](https://github.com/withastro/starlight/commit/3ee1a9404db25f5776a3c1ecd248614f64db46ae) Thanks [@delucis](https://github.com/delucis)! - Translate `fileTree.directory` and `aside.*` UI string into Norwegian (Bokmål).
|
|
12
|
+
|
|
13
|
+
- [#2054](https://github.com/withastro/starlight/pull/2054) [`dbfd3ee`](https://github.com/withastro/starlight/commit/dbfd3eeccacb5f5b77d75213dac3b30dc0be6deb) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes an issue when using the `<StarlightPage>` component in a custom page with a user-defined `srcDir` configuration.
|
|
14
|
+
|
|
15
|
+
## 0.24.4
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#2038](https://github.com/withastro/starlight/pull/2038) [`87f3f92`](https://github.com/withastro/starlight/commit/87f3f925be6f9897b71b09a3041ec6d54be483b2) Thanks [@dragomano](https://github.com/dragomano)! - Updates Russian UI translations
|
|
20
|
+
|
|
21
|
+
- [#2043](https://github.com/withastro/starlight/pull/2043) [`53f4cd4`](https://github.com/withastro/starlight/commit/53f4cd443cf31b6135ff16eb74b5f26ee93ee2d5) Thanks [@playmr365](https://github.com/playmr365)! - Updates Czech UI translations
|
|
22
|
+
|
|
23
|
+
- [#2041](https://github.com/withastro/starlight/pull/2041) [`8af5a60`](https://github.com/withastro/starlight/commit/8af5a60ab14f4dae7f5a5e4ee535ae927273368b) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes `<Steps>` numbering bug caused by Chrome v126 CSS counter rewrite
|
|
24
|
+
|
|
3
25
|
## 0.24.3
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { expect, testFactory } from './test-utils';
|
|
2
|
+
|
|
3
|
+
const test = await testFactory('./fixtures/custom-src-dir/');
|
|
4
|
+
|
|
5
|
+
test('builds a custom page using the `<StarlightPage>` component and a custom `srcDir`', async ({
|
|
6
|
+
page,
|
|
7
|
+
starlight,
|
|
8
|
+
}) => {
|
|
9
|
+
await starlight.goto('/custom');
|
|
10
|
+
|
|
11
|
+
await expect(page.getByText('Hello')).toBeVisible();
|
|
12
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
+
esac
|
|
7
|
+
|
|
8
|
+
if [ -z "$NODE_PATH" ]; then
|
|
9
|
+
export NODE_PATH="/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.10.2_@types+node@18.16.19_typescript@5.4.5/node_modules/astro/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.10.2_@types+node@18.16.19_typescript@5.4.5/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.10.2_@types+node@18.16.19_typescript@5.4.5/node_modules/astro/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.10.2_@types+node@18.16.19_typescript@5.4.5/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../astro/astro.js" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../astro/astro.js" "$@"
|
|
17
|
+
fi
|
package/components/Select.astro
CHANGED
|
@@ -31,6 +31,7 @@ interface Props {
|
|
|
31
31
|
label {
|
|
32
32
|
--sl-label-icon-size: 0.875rem;
|
|
33
33
|
--sl-caret-size: 1.25rem;
|
|
34
|
+
--sl-inline-padding: 0.5rem;
|
|
34
35
|
position: relative;
|
|
35
36
|
display: flex;
|
|
36
37
|
align-items: center;
|
|
@@ -62,8 +63,10 @@ interface Props {
|
|
|
62
63
|
select {
|
|
63
64
|
border: 0;
|
|
64
65
|
padding-block: 0.625rem;
|
|
65
|
-
padding-inline: calc(var(--sl-label-icon-size) +
|
|
66
|
-
|
|
66
|
+
padding-inline: calc(var(--sl-label-icon-size) + var(--sl-inline-padding) + 0.25rem)
|
|
67
|
+
calc(var(--sl-caret-size) + var(--sl-inline-padding) + 0.25rem);
|
|
68
|
+
margin-inline: calc(var(--sl-inline-padding) * -1);
|
|
69
|
+
width: calc(var(--sl-select-width) + var(--sl-inline-padding) * 2);
|
|
67
70
|
background-color: transparent;
|
|
68
71
|
text-overflow: ellipsis;
|
|
69
72
|
color: inherit;
|
package/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ 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';
|
|
6
|
-
import { starlightAsides } from './integrations/asides';
|
|
6
|
+
import { starlightAsides, starlightDirectivesRestorationIntegration } from './integrations/asides';
|
|
7
7
|
import { starlightExpressiveCode } from './integrations/expressive-code/index';
|
|
8
8
|
import { starlightSitemap } from './integrations/sitemap';
|
|
9
9
|
import { vitePluginStarlightUserConfig } from './integrations/virtual-user-config';
|
|
@@ -73,6 +73,10 @@ export default function StarlightIntegration({
|
|
|
73
73
|
if (!allIntegrations.find(({ name }) => name === '@astrojs/mdx')) {
|
|
74
74
|
integrations.push(mdx({ optimize: true }));
|
|
75
75
|
}
|
|
76
|
+
// Add Starlight directives restoration integration at the end of the list so that remark
|
|
77
|
+
// plugins injected by Starlight plugins through Astro integrations can handle text and
|
|
78
|
+
// leaf directives before they are transformed back to their original form.
|
|
79
|
+
integrations.push(starlightDirectivesRestorationIntegration());
|
|
76
80
|
|
|
77
81
|
// Add integrations immediately after Starlight in the config array.
|
|
78
82
|
// e.g. if a user has `integrations: [starlight(), tailwind()]`, then the order will be
|
package/integrations/asides.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="mdast-util-directive" />
|
|
2
2
|
|
|
3
|
-
import type { AstroConfig, AstroUserConfig } from 'astro';
|
|
3
|
+
import type { AstroConfig, AstroIntegration, AstroUserConfig } from 'astro';
|
|
4
4
|
import { h as _h, s as _s, type Properties } from 'hastscript';
|
|
5
5
|
import type { Node, Paragraph as P, Parent, Root } from 'mdast';
|
|
6
6
|
import {
|
|
@@ -146,7 +146,6 @@ function remarkAsides(options: AsidesOptions): Plugin<[], Root> {
|
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
if (node.type === 'textDirective' || node.type === 'leafDirective') {
|
|
149
|
-
transformUnhandledDirective(node, index, parent);
|
|
150
149
|
return;
|
|
151
150
|
}
|
|
152
151
|
const variant = node.name;
|
|
@@ -210,3 +209,43 @@ type RemarkPlugins = NonNullable<NonNullable<AstroUserConfig['markdown']>['remar
|
|
|
210
209
|
export function starlightAsides(options: AsidesOptions): RemarkPlugins {
|
|
211
210
|
return [remarkDirective, remarkAsides(options)];
|
|
212
211
|
}
|
|
212
|
+
|
|
213
|
+
export function remarkDirectivesRestoration() {
|
|
214
|
+
return function transformer(tree: Root) {
|
|
215
|
+
visit(tree, (node, index, parent) => {
|
|
216
|
+
if (
|
|
217
|
+
index !== undefined &&
|
|
218
|
+
parent &&
|
|
219
|
+
(node.type === 'textDirective' || node.type === 'leafDirective')
|
|
220
|
+
) {
|
|
221
|
+
transformUnhandledDirective(node, index, parent);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Directives not handled by Starlight are transformed back to their original form to avoid
|
|
230
|
+
* breaking user content.
|
|
231
|
+
* To allow remark plugins injected by Starlight plugins through Astro integrations to handle
|
|
232
|
+
* such directives, we need to restore unhandled text and leaf directives back to their original
|
|
233
|
+
* form only after all these other plugins have run.
|
|
234
|
+
* To do so, we run a remark plugin restoring these directives back to their original form from
|
|
235
|
+
* another Astro integration that runs after all the ones that may have been injected by Starlight
|
|
236
|
+
* plugins.
|
|
237
|
+
*/
|
|
238
|
+
export function starlightDirectivesRestorationIntegration(): AstroIntegration {
|
|
239
|
+
return {
|
|
240
|
+
name: 'starlight-directives-restoration',
|
|
241
|
+
hooks: {
|
|
242
|
+
'astro:config:setup': ({ updateConfig }) => {
|
|
243
|
+
updateConfig({
|
|
244
|
+
markdown: {
|
|
245
|
+
remarkPlugins: [remarkDirectivesRestoration],
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
};
|
|
251
|
+
}
|
|
@@ -50,7 +50,7 @@ export function vitePluginStarlightUserConfig(
|
|
|
50
50
|
: 'export const logos = {};',
|
|
51
51
|
'virtual:starlight/collection-config': `let userCollections;
|
|
52
52
|
try {
|
|
53
|
-
userCollections = (await import('
|
|
53
|
+
userCollections = (await import('${new URL('./content/config.ts', srcDir).pathname}')).collections;
|
|
54
54
|
} catch {}
|
|
55
55
|
export const collections = userCollections;`,
|
|
56
56
|
...virtualComponentModules,
|
package/package.json
CHANGED
package/playwright.config.ts
CHANGED
package/translations/cs.json
CHANGED
|
@@ -25,5 +25,18 @@
|
|
|
25
25
|
"aside.caution": "Upozornění",
|
|
26
26
|
"aside.danger": "Nebezpečí",
|
|
27
27
|
"fileTree.directory": "Adresář",
|
|
28
|
-
"builtWithStarlight.label": "Postavené s Starlight"
|
|
28
|
+
"builtWithStarlight.label": "Postavené s Starlight",
|
|
29
|
+
"expressiveCode.copyButtonCopied": "Zkopírováno!",
|
|
30
|
+
"expressiveCode.copyButtonTooltip": "Kopíruj do schránky",
|
|
31
|
+
"expressiveCode.terminalWindowFallbackTitle": "Terminál",
|
|
32
|
+
"pagefind.clear_search": "Vyčistit",
|
|
33
|
+
"pagefind.load_more": "Načíst další výsledky",
|
|
34
|
+
"pagefind.search_label": "Vyhledat stránku",
|
|
35
|
+
"pagefind.filters_label": "Filtry",
|
|
36
|
+
"pagefind.zero_results": "Žádný výsledek pro: [SEARCH_TERM]",
|
|
37
|
+
"pagefind.many_results": "počet výsledků: [COUNT] pro: [SEARCH_TERM]",
|
|
38
|
+
"pagefind.one_result": "[COUNT] výsledek pro: [SEARCH_TERM]",
|
|
39
|
+
"pagefind.alt_search": "Žádné výsledky pro [SEARCH_TERM]. Namísto toho zobrazuji výsledky pro: [DIFFERENT_TERM]",
|
|
40
|
+
"pagefind.search_suggestion": "Žádný výsledek pro [SEARCH_TERM]. Zkus nějaké z těchto hledání:",
|
|
41
|
+
"pagefind.searching": "Hledám [SEARCH_TERM]..."
|
|
29
42
|
}
|
package/translations/nb.json
CHANGED
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"page.nextLink": "Neste",
|
|
21
21
|
"page.draft": "This content is a draft and will not be included in production builds.",
|
|
22
22
|
"404.text": "Siden ble ikke funnet. Sjekk URL-en eller prøv å bruke søkefeltet.",
|
|
23
|
-
"aside.note": "
|
|
24
|
-
"aside.tip": "
|
|
25
|
-
"aside.caution": "
|
|
26
|
-
"aside.danger": "
|
|
27
|
-
"fileTree.directory": "
|
|
23
|
+
"aside.note": "Merknad",
|
|
24
|
+
"aside.tip": "Tips",
|
|
25
|
+
"aside.caution": "Advarsel",
|
|
26
|
+
"aside.danger": "Fare",
|
|
27
|
+
"fileTree.directory": "Mappe",
|
|
28
28
|
"builtWithStarlight.label": "Laget med Starlight"
|
|
29
29
|
}
|
package/translations/ru.json
CHANGED
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"expressiveCode.copyButtonCopied": "Скопировано!",
|
|
29
29
|
"expressiveCode.copyButtonTooltip": "Копировать",
|
|
30
30
|
"expressiveCode.terminalWindowFallbackTitle": "Окно терминала",
|
|
31
|
-
"builtWithStarlight.label": "
|
|
31
|
+
"builtWithStarlight.label": "Сделано с помощью Starlight"
|
|
32
32
|
}
|
|
@@ -13,10 +13,12 @@ const { html } = processSteps(content);
|
|
|
13
13
|
--bullet-margin: 0.375rem;
|
|
14
14
|
|
|
15
15
|
list-style: none;
|
|
16
|
+
counter-reset: steps-counter var(--sl-steps-start, 0);
|
|
16
17
|
padding-inline-start: 0;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
.sl-steps > li {
|
|
21
|
+
counter-increment: steps-counter;
|
|
20
22
|
position: relative;
|
|
21
23
|
padding-inline-start: calc(var(--bullet-size) + 1rem);
|
|
22
24
|
/* HACK: Keeps any `margin-bottom` inside the `<li>`’s padding box to avoid gaps in the hairline border. */
|
|
@@ -31,7 +33,7 @@ const { html } = processSteps(content);
|
|
|
31
33
|
|
|
32
34
|
/* Custom list marker element. */
|
|
33
35
|
.sl-steps > li::before {
|
|
34
|
-
content: counter(
|
|
36
|
+
content: counter(steps-counter);
|
|
35
37
|
position: absolute;
|
|
36
38
|
top: 0;
|
|
37
39
|
inset-inline-start: 0;
|
|
@@ -44,6 +44,14 @@ const stepsProcessor = rehype()
|
|
|
44
44
|
} else {
|
|
45
45
|
rootElement.properties.className.push('sl-steps');
|
|
46
46
|
}
|
|
47
|
+
|
|
48
|
+
// Add the `start` attribute as a CSS custom property so we can use it as the starting index
|
|
49
|
+
// of the steps custom counter.
|
|
50
|
+
if (typeof rootElement.properties.start === 'number') {
|
|
51
|
+
const styles = [`--sl-steps-start: ${rootElement.properties.start - 1}`];
|
|
52
|
+
if (rootElement.properties.style) styles.push(String(rootElement.properties.style));
|
|
53
|
+
rootElement.properties.style = styles.join(';');
|
|
54
|
+
}
|
|
47
55
|
};
|
|
48
56
|
});
|
|
49
57
|
|