@astrojs/starlight 0.24.4 → 0.25.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 +45 -0
- package/__e2e__/collection-config.test.ts +12 -0
- package/__e2e__/fixtures/basics/astro.config.mjs +1 -0
- package/__e2e__/fixtures/custom-src-dir/astro.config.mjs +12 -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/__e2e__/test-utils.ts +2 -0
- package/components/Search.astro +45 -19
- 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 +2 -2
- package/playwright.config.ts +2 -0
- package/schemas/i18n.ts +4 -2
- package/schemas/sidebar.ts +28 -3
- package/style/markdown.css +29 -6
- package/style/props.css +1 -0
- package/translations/ar.json +1 -1
- package/translations/cs.json +1 -1
- package/translations/da.json +1 -1
- package/translations/de.json +1 -1
- package/translations/en.json +1 -1
- package/translations/es.json +1 -1
- package/translations/fa.json +1 -1
- package/translations/fr.json +1 -1
- package/translations/gl.json +1 -1
- package/translations/he.json +1 -1
- package/translations/hi.json +1 -1
- package/translations/id.json +1 -1
- package/translations/it.json +1 -1
- package/translations/ja.json +1 -1
- package/translations/ko.json +1 -1
- package/translations/nb.json +6 -6
- package/translations/nl.json +1 -1
- package/translations/pl.json +1 -1
- package/translations/pt.json +1 -1
- package/translations/ro.json +1 -1
- package/translations/ru.json +1 -1
- package/translations/sk.json +1 -1
- package/translations/sv.json +1 -1
- package/translations/tr.json +1 -1
- package/translations/uk.json +5 -5
- package/translations/vi.json +1 -1
- package/translations/zh-CN.json +1 -1
- package/translations/zh-TW.json +1 -1
- package/utils/error-map.ts +6 -1
- package/utils/navigation.ts +38 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.25.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#2025](https://github.com/withastro/starlight/pull/2025) [`47f32c1`](https://github.com/withastro/starlight/commit/47f32c196c5d840a6a45799ddf123d17c77274b0) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Removes the `/` search shortcut for [accessibility reasons](https://www.w3.org/WAI/WCAG21/Understanding/character-key-shortcuts.html).
|
|
8
|
+
|
|
9
|
+
⚠️ **Potentially breaking change:** The `search.shortcutLabel` UI string has been removed. If you were using this string in your custom UI, you will need to update your code.
|
|
10
|
+
|
|
11
|
+
- [#2064](https://github.com/withastro/starlight/pull/2064) [`c5b47cb`](https://github.com/withastro/starlight/commit/c5b47cbe1242f0b29b9212db72fe26590ab57d88) Thanks [@SnowDingo](https://github.com/SnowDingo)! - Improves styling of Markdown tables to work better in different contexts, including against different background colours like when used in asides.
|
|
12
|
+
|
|
13
|
+
- [#2031](https://github.com/withastro/starlight/pull/2031) [`2bab648`](https://github.com/withastro/starlight/commit/2bab648be9ddc6bfe05562650b773f5158a9ed42) Thanks [@delucis](https://github.com/delucis)! - Makes sidebar entry parsing stricter in Starlight config
|
|
14
|
+
|
|
15
|
+
**⚠️ Potentially breaking change:** Previously Starlight would accept a sidebar entry that matched one of its expected shapes, even if it included additional properties. For example, including both `link` and `items` was considered valid, with `items` being ignored. Now, it is an error to include more than one of `link`, `items`, or `autogenerate` in a sidebar entry.
|
|
16
|
+
|
|
17
|
+
If you see errors after updating, look for sidebar entries in the Starlight configuration in `astro.config.mjs` that include too many keys and remove the one that was previously ignored.
|
|
18
|
+
|
|
19
|
+
- [#1874](https://github.com/withastro/starlight/pull/1874) [`eeba06e`](https://github.com/withastro/starlight/commit/eeba06ea7df962e8f0520e145d28b8c17cd32c18) Thanks [@lorenzolewis](https://github.com/lorenzolewis)! - Adds a new syntax for specifying sidebar link items for internal links
|
|
20
|
+
|
|
21
|
+
You can now specify an internal page using only its slug, either as a string, or as an object with a `slug` property:
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
starlight({
|
|
25
|
+
title: 'Docs with easier sidebars',
|
|
26
|
+
sidebar: ['getting-started', { slug: 'guides/installation' }],
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Starlight will use the linked page’s frontmatter to configure the sidebar link.
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- [#2081](https://github.com/withastro/starlight/pull/2081) [`f0181d2`](https://github.com/withastro/starlight/commit/f0181d2689248a46ff3eb6fc604bfcd95d4cb1aa) Thanks [@andrii-bodnar](https://github.com/andrii-bodnar)! - Updates the Ukrainian UI translations
|
|
35
|
+
|
|
36
|
+
## 0.24.5
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- [#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
|
|
41
|
+
|
|
42
|
+
- [#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.
|
|
43
|
+
|
|
44
|
+
- [#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).
|
|
45
|
+
|
|
46
|
+
- [#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.
|
|
47
|
+
|
|
3
48
|
## 0.24.4
|
|
4
49
|
|
|
5
50
|
### 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/__e2e__/test-utils.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { build, preview } from 'astro';
|
|
|
4
4
|
|
|
5
5
|
export { expect, type Locator } from '@playwright/test';
|
|
6
6
|
|
|
7
|
+
process.env.ASTRO_TELEMETRY_DISABLED = 'true';
|
|
8
|
+
|
|
7
9
|
// Setup a test environment that will build and start a preview server for a given fixture path and
|
|
8
10
|
// provide a Starlight Playwright fixture accessible from within all tests.
|
|
9
11
|
export async function testFactory(fixturePath: string) {
|
package/components/Search.astro
CHANGED
|
@@ -20,17 +20,17 @@ const pagefindTranslations = {
|
|
|
20
20
|
data-translations={JSON.stringify(pagefindTranslations)}
|
|
21
21
|
data-strip-trailing-slash={project.trailingSlash === 'never'}
|
|
22
22
|
>
|
|
23
|
-
<button
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
23
|
+
<button
|
|
24
|
+
data-open-modal
|
|
25
|
+
disabled
|
|
26
|
+
aria-label={labels['search.label']}
|
|
27
|
+
aria-keyshortcuts="Control+K"
|
|
28
|
+
>
|
|
29
|
+
<Icon name="magnifier" />
|
|
28
30
|
<span class="sl-hidden md:sl-block" aria-hidden="true">{labels['search.label']}</span>
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
label={labels['search.shortcutLabel']}
|
|
33
|
-
/>
|
|
31
|
+
<kbd class="sl-hidden md:sl-flex" style="display: none;">
|
|
32
|
+
<kbd>{labels['search.ctrlKey']}</kbd><kbd>K</kbd>
|
|
33
|
+
</kbd>
|
|
34
34
|
</button>
|
|
35
35
|
|
|
36
36
|
<dialog style="padding:0" aria-label={labels['search.label']}>
|
|
@@ -56,6 +56,27 @@ const pagefindTranslations = {
|
|
|
56
56
|
</dialog>
|
|
57
57
|
</site-search>
|
|
58
58
|
|
|
59
|
+
{
|
|
60
|
+
/**
|
|
61
|
+
* This is intentionally inlined to avoid briefly showing an invalid shortcut.
|
|
62
|
+
* Purposely using the deprecated `navigator.platform` property to detect Apple devices, as the
|
|
63
|
+
* user agent is spoofed by some browsers when opening the devtools.
|
|
64
|
+
*/
|
|
65
|
+
}
|
|
66
|
+
<script is:inline>
|
|
67
|
+
(() => {
|
|
68
|
+
const openBtn = document.querySelector('button[data-open-modal]');
|
|
69
|
+
const shortcut = openBtn?.querySelector('kbd');
|
|
70
|
+
if (!openBtn || !(shortcut instanceof HTMLElement)) return;
|
|
71
|
+
const platformKey = shortcut.querySelector('kbd');
|
|
72
|
+
if (platformKey && /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)) {
|
|
73
|
+
platformKey.textContent = '⌘';
|
|
74
|
+
openBtn.setAttribute('aria-keyshortcuts', 'Meta+K');
|
|
75
|
+
}
|
|
76
|
+
shortcut.style.display = '';
|
|
77
|
+
})();
|
|
78
|
+
</script>
|
|
79
|
+
|
|
59
80
|
<script>
|
|
60
81
|
class SiteSearch extends HTMLElement {
|
|
61
82
|
constructor() {
|
|
@@ -96,18 +117,11 @@ const pagefindTranslations = {
|
|
|
96
117
|
window.removeEventListener('click', onClick);
|
|
97
118
|
});
|
|
98
119
|
|
|
99
|
-
// Listen for
|
|
120
|
+
// Listen for `ctrl + k` and `cmd + k` keyboard shortcuts.
|
|
100
121
|
window.addEventListener('keydown', (e) => {
|
|
101
|
-
const isInput =
|
|
102
|
-
document.activeElement instanceof HTMLElement &&
|
|
103
|
-
(['input', 'select', 'textarea'].includes(document.activeElement.tagName.toLowerCase()) ||
|
|
104
|
-
document.activeElement.isContentEditable);
|
|
105
122
|
if ((e.metaKey === true || e.ctrlKey === true) && e.key === 'k') {
|
|
106
123
|
dialog.open ? closeModal() : openModal();
|
|
107
124
|
e.preventDefault();
|
|
108
|
-
} else if (e.key === '/' && !dialog.open && !isInput) {
|
|
109
|
-
openModal();
|
|
110
|
-
e.preventDefault();
|
|
111
125
|
}
|
|
112
126
|
});
|
|
113
127
|
|
|
@@ -169,7 +183,7 @@ const pagefindTranslations = {
|
|
|
169
183
|
border: 1px solid var(--sl-color-gray-5);
|
|
170
184
|
border-radius: 0.5rem;
|
|
171
185
|
padding-inline-start: 0.75rem;
|
|
172
|
-
padding-inline-end:
|
|
186
|
+
padding-inline-end: 0.5rem;
|
|
173
187
|
background-color: var(--sl-color-black);
|
|
174
188
|
color: var(--sl-color-gray-2);
|
|
175
189
|
font-size: var(--sl-text-sm);
|
|
@@ -186,6 +200,18 @@ const pagefindTranslations = {
|
|
|
186
200
|
}
|
|
187
201
|
}
|
|
188
202
|
|
|
203
|
+
button > kbd {
|
|
204
|
+
border-radius: 0.25rem;
|
|
205
|
+
font-size: var(--sl-text-2xs);
|
|
206
|
+
gap: 0.25em;
|
|
207
|
+
padding-inline: 0.375rem;
|
|
208
|
+
background-color: var(--sl-color-gray-6);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
kbd {
|
|
212
|
+
font-family: var(--__sl-font);
|
|
213
|
+
}
|
|
214
|
+
|
|
189
215
|
dialog {
|
|
190
216
|
margin: 0;
|
|
191
217
|
background-color: var(--sl-color-gray-6);
|
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/starlight",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "Build beautiful, high-performance documentation websites with Astro",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
},
|
|
176
176
|
"devDependencies": {
|
|
177
177
|
"@astrojs/markdown-remark": "^5.1.0",
|
|
178
|
-
"@playwright/test": "^1.
|
|
178
|
+
"@playwright/test": "^1.45.0",
|
|
179
179
|
"@types/node": "^18.16.19",
|
|
180
180
|
"@vitest/coverage-v8": "^1.6.0",
|
|
181
181
|
"astro": "^4.10.2",
|
package/playwright.config.ts
CHANGED
package/schemas/i18n.ts
CHANGED
|
@@ -55,9 +55,11 @@ function starlightI18nSchema() {
|
|
|
55
55
|
|
|
56
56
|
'search.label': z.string().describe('Text displayed in the search bar.'),
|
|
57
57
|
|
|
58
|
-
'search.
|
|
58
|
+
'search.ctrlKey': z
|
|
59
59
|
.string()
|
|
60
|
-
.describe(
|
|
60
|
+
.describe(
|
|
61
|
+
'Visible representation of the Control key potentially used in the shortcut key to open the search modal.'
|
|
62
|
+
),
|
|
61
63
|
|
|
62
64
|
'search.cancelLabel': z
|
|
63
65
|
.string()
|
package/schemas/sidebar.ts
CHANGED
|
@@ -33,7 +33,7 @@ const SidebarLinkItemSchema = SidebarBaseSchema.extend({
|
|
|
33
33
|
link: z.string(),
|
|
34
34
|
/** HTML attributes to add to the link item. */
|
|
35
35
|
attrs: SidebarLinkItemHTMLAttributesSchema(),
|
|
36
|
-
});
|
|
36
|
+
}).strict();
|
|
37
37
|
export type SidebarLinkItem = z.infer<typeof SidebarLinkItemSchema>;
|
|
38
38
|
|
|
39
39
|
const AutoSidebarGroupSchema = SidebarGroupSchema.extend({
|
|
@@ -50,7 +50,7 @@ const AutoSidebarGroupSchema = SidebarGroupSchema.extend({
|
|
|
50
50
|
/** How many directories deep to include from this directory in the sidebar. Default: `Infinity`. */
|
|
51
51
|
// depth: z.number().optional(),
|
|
52
52
|
}),
|
|
53
|
-
});
|
|
53
|
+
}).strict();
|
|
54
54
|
export type AutoSidebarGroup = z.infer<typeof AutoSidebarGroupSchema>;
|
|
55
55
|
|
|
56
56
|
type ManualSidebarGroupInput = z.input<typeof SidebarGroupSchema> & {
|
|
@@ -58,6 +58,8 @@ type ManualSidebarGroupInput = z.input<typeof SidebarGroupSchema> & {
|
|
|
58
58
|
items: Array<
|
|
59
59
|
| z.input<typeof SidebarLinkItemSchema>
|
|
60
60
|
| z.input<typeof AutoSidebarGroupSchema>
|
|
61
|
+
| z.input<typeof InternalSidebarLinkItemSchema>
|
|
62
|
+
| z.input<typeof InternalSidebarLinkItemShorthandSchema>
|
|
61
63
|
| ManualSidebarGroupInput
|
|
62
64
|
>;
|
|
63
65
|
};
|
|
@@ -67,6 +69,8 @@ type ManualSidebarGroupOutput = z.output<typeof SidebarGroupSchema> & {
|
|
|
67
69
|
items: Array<
|
|
68
70
|
| z.output<typeof SidebarLinkItemSchema>
|
|
69
71
|
| z.output<typeof AutoSidebarGroupSchema>
|
|
72
|
+
| z.output<typeof InternalSidebarLinkItemSchema>
|
|
73
|
+
| z.output<typeof InternalSidebarLinkItemShorthandSchema>
|
|
70
74
|
| ManualSidebarGroupOutput
|
|
71
75
|
>;
|
|
72
76
|
};
|
|
@@ -78,13 +82,34 @@ const ManualSidebarGroupSchema: z.ZodType<
|
|
|
78
82
|
> = SidebarGroupSchema.extend({
|
|
79
83
|
/** Array of links and subcategories to display in this category. */
|
|
80
84
|
items: z.lazy(() =>
|
|
81
|
-
z
|
|
85
|
+
z
|
|
86
|
+
.union([
|
|
87
|
+
SidebarLinkItemSchema,
|
|
88
|
+
ManualSidebarGroupSchema,
|
|
89
|
+
AutoSidebarGroupSchema,
|
|
90
|
+
InternalSidebarLinkItemSchema,
|
|
91
|
+
InternalSidebarLinkItemShorthandSchema,
|
|
92
|
+
])
|
|
93
|
+
.array()
|
|
82
94
|
),
|
|
95
|
+
}).strict();
|
|
96
|
+
|
|
97
|
+
const InternalSidebarLinkItemSchema = SidebarBaseSchema.partial({ label: true }).extend({
|
|
98
|
+
/** The link to this item’s content. Must be a slug of a Content Collection entry. */
|
|
99
|
+
slug: z.string(),
|
|
100
|
+
/** HTML attributes to add to the link item. */
|
|
101
|
+
attrs: SidebarLinkItemHTMLAttributesSchema(),
|
|
83
102
|
});
|
|
103
|
+
const InternalSidebarLinkItemShorthandSchema = z
|
|
104
|
+
.string()
|
|
105
|
+
.transform((slug) => InternalSidebarLinkItemSchema.parse({ slug }));
|
|
106
|
+
export type InternalSidebarLinkItem = z.output<typeof InternalSidebarLinkItemSchema>;
|
|
84
107
|
|
|
85
108
|
export const SidebarItemSchema = z.union([
|
|
86
109
|
SidebarLinkItemSchema,
|
|
87
110
|
ManualSidebarGroupSchema,
|
|
88
111
|
AutoSidebarGroupSchema,
|
|
112
|
+
InternalSidebarLinkItemSchema,
|
|
113
|
+
InternalSidebarLinkItemShorthandSchema,
|
|
89
114
|
]);
|
|
90
115
|
export type SidebarItem = z.infer<typeof SidebarItemSchema>;
|
package/style/markdown.css
CHANGED
|
@@ -100,17 +100,40 @@
|
|
|
100
100
|
padding-inline-start: 1rem;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
/* Table styling */
|
|
103
104
|
.sl-markdown-content table:not(:where(.not-content *)) {
|
|
104
105
|
display: block;
|
|
105
106
|
overflow: auto;
|
|
106
|
-
border-
|
|
107
|
-
}
|
|
108
|
-
.sl-markdown-content tr:nth-child(2n):not(:where(.not-content *)) {
|
|
109
|
-
background-color: var(--sl-color-gray-7, var(--sl-color-gray-6));
|
|
107
|
+
border-spacing: 0;
|
|
110
108
|
}
|
|
111
109
|
.sl-markdown-content :is(th, td):not(:where(.not-content *)) {
|
|
112
|
-
border: 1px solid var(--sl-color-
|
|
113
|
-
padding: 0.
|
|
110
|
+
border-bottom: 1px solid var(--sl-color-gray-5);
|
|
111
|
+
padding: 0.5rem 1rem;
|
|
112
|
+
/* Align text to the top of the row in multiline tables. */
|
|
113
|
+
vertical-align: baseline;
|
|
114
|
+
}
|
|
115
|
+
.sl-markdown-content :is(th:first-child, td:first-child):not(:where(.not-content *)) {
|
|
116
|
+
padding-inline-start: 0;
|
|
117
|
+
}
|
|
118
|
+
.sl-markdown-content :is(th:last-child, td:last-child):not(:where(.not-content *)) {
|
|
119
|
+
padding-inline-end: 0;
|
|
120
|
+
}
|
|
121
|
+
.sl-markdown-content th:not(:where(.not-content *)) {
|
|
122
|
+
color: var(--sl-color-white);
|
|
123
|
+
font-weight: 600;
|
|
124
|
+
}
|
|
125
|
+
/* Align headings to the start of the line unless set by the `align` attribute. */
|
|
126
|
+
.sl-markdown-content th:not([align]):not(:where(.not-content *)) {
|
|
127
|
+
text-align: start;
|
|
128
|
+
}
|
|
129
|
+
/* Table styles inside asides */
|
|
130
|
+
.sl-markdown-content .starlight-aside :is(th, td):not(:where(.not-content *)) {
|
|
131
|
+
border-color: var(--sl-color-gray-4);
|
|
132
|
+
}
|
|
133
|
+
@supports (border-color: color-mix(in srgb, var(--sl-color-asides-text-accent) 30%, transparent)) {
|
|
134
|
+
.sl-markdown-content .starlight-aside :is(th, td):not(:where(.not-content *)) {
|
|
135
|
+
border-color: color-mix(in srgb, var(--sl-color-asides-text-accent) 30%, transparent);
|
|
136
|
+
}
|
|
114
137
|
}
|
|
115
138
|
|
|
116
139
|
.sl-markdown-content hr:not(:where(.not-content *)) {
|
package/style/props.css
CHANGED
package/translations/ar.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "تخطَّ إلى المحتوى",
|
|
3
3
|
"search.label": "ابحث",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "إلغاء",
|
|
6
6
|
"search.devWarning": "البحث متوفر فقط في بنيات اﻹنتاج. \n جرب بناء المشروع ومعاينته على جهازك",
|
|
7
7
|
"themeSelect.accessibleLabel": "اختر سمة",
|
package/translations/cs.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Přeskočit na obsah",
|
|
3
3
|
"search.label": "Hledat",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Zrušit",
|
|
6
6
|
"search.devWarning": "Vyhledávání je dostupné pouze v produkčních sestaveních. \nZkuste sestavit a zobrazit náhled webu a otestovat jej lokálně.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Vyberte motiv",
|
package/translations/da.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Gå til indhold",
|
|
3
3
|
"search.label": "Søg",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Annuller",
|
|
6
6
|
"search.devWarning": "Søgning er kun tilgængeligt i produktions versioner. \nPrøv at bygge siden og forhåndsvis den for at teste det lokalt.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Vælg tema",
|
package/translations/de.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Zum Inhalt springen",
|
|
3
3
|
"search.label": "Suchen",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Strg",
|
|
5
5
|
"search.cancelLabel": "Abbrechen",
|
|
6
6
|
"search.devWarning": "Search is only available in production builds. \nTry building and previewing the site to test it out locally.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Farbschema wählen",
|
package/translations/en.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Skip to content",
|
|
3
3
|
"search.label": "Search",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Cancel",
|
|
6
6
|
"search.devWarning": "Search is only available in production builds. \nTry building and previewing the site to test it out locally.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Select theme",
|
package/translations/es.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Saltearse al contenido",
|
|
3
3
|
"search.label": "Buscar",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Interrumpir",
|
|
6
6
|
"search.devWarning": "La búsqueda solo está disponible en las versiones de producción. \nIntenta construir y previsualizar el sitio para probarlo localmente.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Seleccionar tema",
|
package/translations/fa.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "رفتن به محتوا",
|
|
3
3
|
"search.label": "جستجو",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "لغو",
|
|
6
6
|
"search.devWarning": "جستجو تنها در نسخههای تولیدی در دسترس است. \nسعی کنید سایت را بسازید و پیشنمایش آن را به صورت محلی آزمایش کنید.",
|
|
7
7
|
"themeSelect.accessibleLabel": "انتخاب پوسته",
|
package/translations/fr.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Aller au contenu",
|
|
3
3
|
"search.label": "Rechercher",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Annuler",
|
|
6
6
|
"search.devWarning": "La recherche est disponible uniquement en mode production. \nEssayez de construire puis de prévisualiser votre site pour tester la recherche localement.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Selectionner le thème",
|
package/translations/gl.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Ir ao contido",
|
|
3
3
|
"search.label": "Busca",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Deixar",
|
|
6
6
|
"search.devWarning": "A busca só está dispoñible nas versións de producción. \nTrata de construir e ollear o sitio para probalo localmente.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Seleciona tema",
|
package/translations/he.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "דלגו לתוכן",
|
|
3
3
|
"search.label": "חיפוש",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "ביטול",
|
|
6
6
|
"search.devWarning": "החיפוש זמין רק בסביבת ייצור. \nנסו לבנות ולהציג תצוגה מקדימה של האתר כדי לבדוק אותו באופן מקומי.",
|
|
7
7
|
"themeSelect.accessibleLabel": "בחרו פרופיל צבע",
|
package/translations/hi.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "इसे छोड़कर कंटेंट पर जाएं",
|
|
3
3
|
"search.label": "खोजें",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "रद्द करे",
|
|
6
6
|
"search.devWarning": "खोज केवल उत्पादन बिल्ड में उपलब्ध है। \nस्थानीय स्तर पर परीक्षण करने के लिए साइट बनाए और उसका पूर्वावलोकन करने का प्रयास करें।",
|
|
7
7
|
"themeSelect.accessibleLabel": "थीम चुनें",
|
package/translations/id.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Lewati ke konten",
|
|
3
3
|
"search.label": "Pencarian",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Batal",
|
|
6
6
|
"search.devWarning": "Pencarian hanya tersedia pada build produksi. \nLakukan proses build dan pratinjau situs Anda sebelum mencoba di lingkungan lokal.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Pilih tema",
|
package/translations/it.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Salta ai contenuti",
|
|
3
3
|
"search.label": "Cerca",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Cancella",
|
|
6
6
|
"search.devWarning": "La ricerca è disponibile solo nelle build di produzione. \nProvare ad eseguire il processo di build e visualizzare la preview del sito per testarlo localmente.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Seleziona tema",
|
package/translations/ja.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "コンテンツにスキップ",
|
|
3
3
|
"search.label": "検索",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "キャンセル",
|
|
6
6
|
"search.devWarning": "検索はプロダクションビルドでのみ利用可能です。\nローカルでテストするには、サイトをビルドしてプレビューしてください。",
|
|
7
7
|
"themeSelect.accessibleLabel": "テーマの選択",
|
package/translations/ko.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "컨텐츠로 건너뛰기",
|
|
3
3
|
"search.label": "검색",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "취소",
|
|
6
6
|
"search.devWarning": "검색 기능은 운영 환경에서만 사용할 수 있습니다. \n로컬에서 테스트하려면 사이트를 빌드하고 미리보기를 해보세요.",
|
|
7
7
|
"themeSelect.accessibleLabel": "테마 선택",
|
package/translations/nb.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Gå til innholdet",
|
|
3
3
|
"search.label": "Søk",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Avbryt",
|
|
6
6
|
"search.devWarning": "Søk er bare tilgjengelig i produksjonsbygg. \nPrøv å bygg siden og forhåndsvis den for å teste det lokalt.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Velg tema",
|
|
@@ -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/nl.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Ga naar inhoud",
|
|
3
3
|
"search.label": "Zoeken",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Annuleren",
|
|
6
6
|
"search.devWarning": "Zoeken is alleen beschikbaar tijdens productie. \nProbeer om de site te builden en er een preview van te bekijken om lokaal te testen.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Selecteer thema",
|
package/translations/pl.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Przejdź do głównej zawartości",
|
|
3
3
|
"search.label": "Szukaj",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Anuluj",
|
|
6
6
|
"search.devWarning": "Wyszukiwanie jest dostępne tylko w buildach produkcyjnych. \nSpróbuj zbudować i uruchomić aplikację, aby przetestować lokalnie.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Wybierz motyw",
|
package/translations/pt.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Pular para o conteúdo",
|
|
3
3
|
"search.label": "Pesquisar",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Cancelar",
|
|
6
6
|
"search.devWarning": "A pesquisa está disponível apenas em builds em produção. \nTente fazer a build e pré-visualize o site para testar localmente.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Selecionar tema",
|
package/translations/ro.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Sari la conținut",
|
|
3
3
|
"search.label": "Caută",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Anulează",
|
|
6
6
|
"search.devWarning": "Căutarea este disponibilă numai în versiunea de producție. \nÎncercă să construiești și să previzualizezi site-ul pentru a-l testa local.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Selectează tema",
|
package/translations/ru.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Перейти к содержимому",
|
|
3
3
|
"search.label": "Поиск",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Отменить",
|
|
6
6
|
"search.devWarning": "Поиск доступен только в производственных сборках. \nПопробуйте выполнить сборку и просмотреть сайт, чтобы протестировать его локально.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Выберите тему",
|
package/translations/sk.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Preskočiť na obsah",
|
|
3
3
|
"search.label": "Hľadať",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Zrušiť",
|
|
6
6
|
"search.devWarning": "Vyhľadávanie je dostupné len v produkčných zostaveniach. \nSkúste vytvoriť a zobraziť náhľad stránky lokálne.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Vyberte tému",
|
package/translations/sv.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Hoppa till innehåll",
|
|
3
3
|
"search.label": "Sök",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Avbryt",
|
|
6
6
|
"search.devWarning": "Sökfunktionen är endast tillgänglig i produktionsbyggen. \nProva att bygga och förhandsvisa siten för att testa det lokalt.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Välj tema",
|
package/translations/tr.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "İçeriğe geç",
|
|
3
3
|
"search.label": "Ara",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "İptal",
|
|
6
6
|
"search.devWarning": "Arama yalnızca üretim derlemelerinde kullanılabilir. \nYerel bilgisayarınızda test etmek için siteyi derleyin ve önizleme yapın.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Tema seç",
|
package/translations/uk.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Перейти до вмісту",
|
|
3
3
|
"search.label": "Пошук",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Скасувати",
|
|
6
|
-
"search.devWarning": "Пошук доступний лише у виробничих
|
|
6
|
+
"search.devWarning": "Пошук доступний лише у виробничих збірках. \nСпробуйте зібрати та переглянути сайт, щоби протестувати його локально",
|
|
7
7
|
"themeSelect.accessibleLabel": "Обрати тему",
|
|
8
8
|
"themeSelect.dark": "Темна",
|
|
9
9
|
"themeSelect.light": "Світла",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"page.lastUpdated": "Останнє оновлення:",
|
|
19
19
|
"page.previousLink": "Назад",
|
|
20
20
|
"page.nextLink": "Далі",
|
|
21
|
-
"page.draft": "
|
|
21
|
+
"page.draft": "Цей контент є чернеткою і не буде включений до виробничих збірок.",
|
|
22
22
|
"404.text": "Сторінку не знайдено. Перевірте URL або спробуйте скористатися пошуком.",
|
|
23
23
|
"aside.note": "Заувага",
|
|
24
24
|
"aside.tip": "Порада",
|
|
25
25
|
"aside.caution": "Обережно",
|
|
26
26
|
"aside.danger": "Небезпечно",
|
|
27
|
-
"fileTree.directory": "
|
|
28
|
-
"builtWithStarlight.label": "
|
|
27
|
+
"fileTree.directory": "Каталог",
|
|
28
|
+
"builtWithStarlight.label": "Створено з Starlight"
|
|
29
29
|
}
|
package/translations/vi.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"skipLink.label": "Bỏ qua nội dung",
|
|
3
3
|
"search.label": "Tìm kiếm",
|
|
4
|
-
"search.
|
|
4
|
+
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Thoát",
|
|
6
6
|
"search.devWarning": "Tìm kiếm không khả dụng khi đang trong môi trường lập trình. \nThử xuất bản website và tìm kiếm.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Chọn giao diện",
|
package/translations/zh-CN.json
CHANGED
package/translations/zh-TW.json
CHANGED
package/utils/error-map.ts
CHANGED
|
@@ -88,7 +88,12 @@ const errorMap: z.ZodErrorMap = (baseError, ctx) => {
|
|
|
88
88
|
expectedShape.push(relativePath);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
|
|
91
|
+
if (expectedShape.length === 1 && !expectedShape[0]?.includes(':')) {
|
|
92
|
+
// In this case the expected shape is not an object, but probably a literal type, e.g. `['string']`.
|
|
93
|
+
expectedShapes.push(expectedShape.join(''));
|
|
94
|
+
} else {
|
|
95
|
+
expectedShapes.push(`{ ${expectedShape.join('; ')} }`);
|
|
96
|
+
}
|
|
92
97
|
}
|
|
93
98
|
if (expectedShapes.length) {
|
|
94
99
|
details.push('> Expected type `' + expectedShapes.join(' | ') + '`');
|
package/utils/navigation.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { AstroError } from 'astro/errors';
|
|
1
2
|
import config from 'virtual:starlight/user-config';
|
|
2
3
|
import type { Badge } from '../schemas/badge';
|
|
3
4
|
import type { PrevNextLinkConfig } from '../schemas/prevNextLink';
|
|
4
5
|
import type {
|
|
5
6
|
AutoSidebarGroup,
|
|
7
|
+
InternalSidebarLinkItem,
|
|
6
8
|
LinkHTMLAttributes,
|
|
7
9
|
SidebarItem,
|
|
8
10
|
SidebarLinkItem,
|
|
@@ -11,7 +13,7 @@ import { createPathFormatter } from './createPathFormatter';
|
|
|
11
13
|
import { formatPath } from './format-path';
|
|
12
14
|
import { pickLang } from './i18n';
|
|
13
15
|
import { ensureLeadingSlash, ensureTrailingSlash, stripLeadingAndTrailingSlashes } from './path';
|
|
14
|
-
import { getLocaleRoutes, type Route } from './routing';
|
|
16
|
+
import { getLocaleRoutes, routes, type Route } from './routing';
|
|
15
17
|
import { localeToLang, slugToPathname } from './slugs';
|
|
16
18
|
|
|
17
19
|
const DirKey = Symbol('DirKey');
|
|
@@ -70,9 +72,11 @@ function configItemToEntry(
|
|
|
70
72
|
routes: Route[]
|
|
71
73
|
): SidebarEntry {
|
|
72
74
|
if ('link' in item) {
|
|
73
|
-
return
|
|
75
|
+
return linkFromSidebarLinkItem(item, locale, currentPathname);
|
|
74
76
|
} else if ('autogenerate' in item) {
|
|
75
77
|
return groupFromAutogenerateConfig(item, locale, routes, currentPathname);
|
|
78
|
+
} else if ('slug' in item) {
|
|
79
|
+
return linkFromInternalSidebarLinkItem(item, locale, currentPathname);
|
|
76
80
|
} else {
|
|
77
81
|
return {
|
|
78
82
|
type: 'group',
|
|
@@ -113,8 +117,8 @@ function groupFromAutogenerateConfig(
|
|
|
113
117
|
/** Check if a string starts with one of `http://` or `https://`. */
|
|
114
118
|
const isAbsolute = (link: string) => /^https?:\/\//.test(link);
|
|
115
119
|
|
|
116
|
-
/** Create a link entry from a user config
|
|
117
|
-
function
|
|
120
|
+
/** Create a link entry from a manual link item in user config. */
|
|
121
|
+
function linkFromSidebarLinkItem(
|
|
118
122
|
item: SidebarLinkItem,
|
|
119
123
|
locale: string | undefined,
|
|
120
124
|
currentPathname: string
|
|
@@ -129,6 +133,36 @@ function linkFromConfig(
|
|
|
129
133
|
return makeLink(href, label, currentPathname, item.badge, item.attrs);
|
|
130
134
|
}
|
|
131
135
|
|
|
136
|
+
/** Create a link entry from an automatic internal link item in user config. */
|
|
137
|
+
function linkFromInternalSidebarLinkItem(
|
|
138
|
+
item: InternalSidebarLinkItem,
|
|
139
|
+
locale: string | undefined,
|
|
140
|
+
currentPathname: string
|
|
141
|
+
) {
|
|
142
|
+
let slugWithLocale = locale ? locale + '/' + item.slug : item.slug;
|
|
143
|
+
// Astro passes root `index.[md|mdx]` entries with a slug of `index`
|
|
144
|
+
slugWithLocale = slugWithLocale.replace(/\/?index$/, '');
|
|
145
|
+
const entry = routes.find((entry) => slugWithLocale === entry.slug);
|
|
146
|
+
if (!entry) {
|
|
147
|
+
const hasExternalSlashes = item.slug.at(0) === '/' || item.slug.at(-1) === '/';
|
|
148
|
+
if (hasExternalSlashes) {
|
|
149
|
+
throw new AstroError(
|
|
150
|
+
`The slug \`"${item.slug}"\` specified in the Starlight sidebar config must not start or end with a slash.`,
|
|
151
|
+
`Please try updating \`"${item.slug}"\` to \`"${stripLeadingAndTrailingSlashes(item.slug)}"\`.`
|
|
152
|
+
);
|
|
153
|
+
} else {
|
|
154
|
+
throw new AstroError(
|
|
155
|
+
`The slug \`"${item.slug}"\` specified in the Starlight sidebar config does not exist.`,
|
|
156
|
+
'Update the Starlight config to reference a valid entry slug in the docs content collection.\n' +
|
|
157
|
+
'Learn more about Astro content collection slugs at https://docs.astro.build/en/reference/api-reference/#getentry'
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const label =
|
|
162
|
+
pickLang(item.translations, localeToLang(locale)) || item.label || entry.entry.data.title;
|
|
163
|
+
return makeLink(entry.slug, label, currentPathname, item.badge, item.attrs);
|
|
164
|
+
}
|
|
165
|
+
|
|
132
166
|
/** Create a link entry. */
|
|
133
167
|
function makeLink(
|
|
134
168
|
href: string,
|