@astrojs/starlight 0.22.2 → 0.22.4
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/404.astro +1 -0
- package/CHANGELOG.md +26 -0
- package/components/CallToAction.astro +1 -1
- package/components/Icons.ts +11 -0
- package/components/SiteTitle.astro +2 -5
- package/integrations/expressive-code/index.ts +1 -1
- package/package.json +4 -3
- package/schemas/social.ts +4 -0
- package/style/markdown.css +4 -0
- package/translations/tr.json +6 -6
- package/translations/vi.json +1 -1
- package/user-components/Tabs.astro +1 -0
- package/user-components/rehype-steps.ts +18 -8
- package/utils/route-data.ts +8 -0
- package/utils/starlight-page.ts +8 -1
package/404.astro
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.22.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1871](https://github.com/withastro/starlight/pull/1871) [`03bb126b`](https://github.com/withastro/starlight/commit/03bb126b74d9adaba1be2f0df3f34566815dd77f) Thanks [@delucis](https://github.com/delucis)! - Adds a `blueSky` icon and social link option
|
|
8
|
+
|
|
9
|
+
- [#1873](https://github.com/withastro/starlight/pull/1873) [`13f33b81`](https://github.com/withastro/starlight/commit/13f33b81fd51d18165eb52f2a0c02b890084e4bd) Thanks [@ekfuhrmann](https://github.com/ekfuhrmann)! - Adds 1 new icon: `alpine`
|
|
10
|
+
|
|
11
|
+
- [#1857](https://github.com/withastro/starlight/pull/1857) [`32cdfaf0`](https://github.com/withastro/starlight/commit/32cdfaf0155e65ff6fbe9c0cfacd6969ab0015d9) Thanks [@tarikcoskun](https://github.com/tarikcoskun)! - Updates Turkish UI translations
|
|
12
|
+
|
|
13
|
+
- [#1736](https://github.com/withastro/starlight/pull/1736) [`cfa94a34`](https://github.com/withastro/starlight/commit/cfa94a346ef10804b90db28d217be175e1c1d5ed) Thanks [@julien-deramond](https://github.com/julien-deramond)! - Prevent list items from overflowing Markdown content
|
|
14
|
+
|
|
15
|
+
## 0.22.3
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#1838](https://github.com/withastro/starlight/pull/1838) [`9fe84754`](https://github.com/withastro/starlight/commit/9fe847544f1edb85bf5b25cd81db39227814335e) Thanks [@delucis](https://github.com/delucis)! - Adds extra information to the errors thrown by the `<Steps>` component to help locate misformatted code
|
|
20
|
+
|
|
21
|
+
- [#1863](https://github.com/withastro/starlight/pull/1863) [`50be60bb`](https://github.com/withastro/starlight/commit/50be60bbc5cbc42db42e868b9e8f128b4dcbd6a5) Thanks [@torn4dom4n](https://github.com/torn4dom4n)! - Update Vietnamese translation
|
|
22
|
+
|
|
23
|
+
- [#1837](https://github.com/withastro/starlight/pull/1837) [`a33a1223`](https://github.com/withastro/starlight/commit/a33a12231772c1dc4b7cc2db3477a6802f3ef53e) Thanks [@delucis](https://github.com/delucis)! - Adds three new icons: `comment`, `comment-alt`, `heart`
|
|
24
|
+
|
|
25
|
+
- [#1842](https://github.com/withastro/starlight/pull/1842) [`c7838636`](https://github.com/withastro/starlight/commit/c7838636edb8d60a2422ce76a2db511b9cebbb70) Thanks [@delucis](https://github.com/delucis)! - Moves the `href` used in the site title link to Starlight’s route data object. This makes it possible for overrides to change the title link while reusing Starlight’s default component implemenation.
|
|
26
|
+
|
|
27
|
+
- [#1840](https://github.com/withastro/starlight/pull/1840) [`cb85563c`](https://github.com/withastro/starlight/commit/cb85563c9a3d4eb2925ad884e6a4e8698a15381b) Thanks [@MiahaCybersec](https://github.com/MiahaCybersec)! - Adds 1 new icon: `hackerone`
|
|
28
|
+
|
|
3
29
|
## 0.22.2
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -7,7 +7,7 @@ interface Props {
|
|
|
7
7
|
variant: 'primary' | 'secondary' | 'minimal';
|
|
8
8
|
link: string;
|
|
9
9
|
icon?: undefined | { type: 'icon'; name: keyof typeof Icons } | { type: 'raw'; html: string };
|
|
10
|
-
attrs?: Omit<HTMLAttributes<'a'>, 'href'
|
|
10
|
+
attrs?: Omit<HTMLAttributes<'a'>, 'href'> | undefined;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const { link, variant, icon } = Astro.props;
|
package/components/Icons.ts
CHANGED
|
@@ -56,6 +56,12 @@ export const BuiltInIcons = {
|
|
|
56
56
|
'<path d="M3.71 16.29a1 1 0 0 0-.33-.21 1 1 0 0 0-.76 0 1 1 0 0 0-.33.21 1 1 0 0 0-.21.33 1 1 0 0 0 .21 1.09c.097.088.209.16.33.21a.94.94 0 0 0 .76 0 1.15 1.15 0 0 0 .33-.21 1 1 0 0 0 .21-1.09 1 1 0 0 0-.21-.33ZM7 8h14a1 1 0 1 0 0-2H7a1 1 0 0 0 0 2Zm-3.29 3.29a1 1 0 0 0-1.09-.21 1.15 1.15 0 0 0-.33.21 1 1 0 0 0-.21.33.94.94 0 0 0 0 .76c.05.121.122.233.21.33.097.088.209.16.33.21a.94.94 0 0 0 .76 0 1.15 1.15 0 0 0 .33-.21 1.15 1.15 0 0 0 .21-.33.94.94 0 0 0 0-.76 1 1 0 0 0-.21-.33ZM21 11H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2ZM3.71 6.29a1 1 0 0 0-.33-.21 1 1 0 0 0-1.09.21 1.15 1.15 0 0 0-.21.33.94.94 0 0 0 0 .76c.05.121.122.233.21.33.097.088.209.16.33.21a1 1 0 0 0 1.09-.21 1.15 1.15 0 0 0 .21-.33.94.94 0 0 0 0-.76 1.15 1.15 0 0 0-.21-.33ZM21 16H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2Z"/>',
|
|
57
57
|
random:
|
|
58
58
|
'<path d="M8.7 10a1 1 0 0 0 1.41 0 1 1 0 0 0 0-1.41l-6.27-6.3a1 1 0 0 0-1.42 1.42ZM21 14a1 1 0 0 0-1 1v3.59L15.44 14A1 1 0 0 0 14 15.44L18.59 20H15a1 1 0 0 0 0 2h6a1 1 0 0 0 .38-.08 1 1 0 0 0 .54-.54A1 1 0 0 0 22 21v-6a1 1 0 0 0-1-1Zm.92-11.38a1 1 0 0 0-.54-.54A1 1 0 0 0 21 2h-6a1 1 0 0 0 0 2h3.59L2.29 20.29a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0L20 5.41V9a1 1 0 0 0 2 0V3a1 1 0 0 0-.08-.38Z"/>',
|
|
59
|
+
comment:
|
|
60
|
+
'<path d="M12 2A10 10 0 0 0 2 12a9.9 9.9 0 0 0 2.3 6.3l-2 2a1 1 0 0 0-.3 1.1 1 1 0 0 0 1 .6h9a10 10 0 0 0 0-20m0 18H5.4l1-1a1 1 0 0 0 0-1.3A8 8 0 1 1 12 20"/>',
|
|
61
|
+
'comment-alt':
|
|
62
|
+
'<path d="M19 2H5a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h11.6l3.7 3.7a1 1 0 0 0 .7.3.8.8 0 0 0 .4 0 1 1 0 0 0 .6-1V5a3 3 0 0 0-3-3m1 16.6-2.3-2.3a1 1 0 0 0-.7-.3H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1Z"/>',
|
|
63
|
+
heart:
|
|
64
|
+
'<path d="M20.16 5A6.29 6.29 0 0 0 12 4.36a6.27 6.27 0 0 0-8.16 9.48l6.21 6.22a2.78 2.78 0 0 0 3.9 0l6.21-6.22a6.27 6.27 0 0 0 0-8.84m-1.41 7.46-6.21 6.21a.76.76 0 0 1-1.08 0l-6.21-6.24a4.29 4.29 0 0 1 0-6 4.27 4.27 0 0 1 6 0 1 1 0 0 0 1.42 0 4.27 4.27 0 0 1 6 0 4.29 4.29 0 0 1 .08 6Z"/>',
|
|
59
65
|
github:
|
|
60
66
|
'<path d="M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3Z"/>',
|
|
61
67
|
gitlab:
|
|
@@ -109,10 +115,15 @@ export const BuiltInIcons = {
|
|
|
109
115
|
'<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"/>',
|
|
110
116
|
matrix:
|
|
111
117
|
'<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"/>',
|
|
118
|
+
hackerOne:
|
|
119
|
+
'<path d="M7.2 0Q6.5 0 6 .3a1 1 0 0 0-.4.8v21.8q0 .4.4.7.5.4 1.2.4t1.2-.3q.5-.4.5-.8V1c0-.3-.2-.6-.5-.8Q7.9 0 7.2 0m9.5 8.7q-.7 0-1.1.3L11 11.7c-.2.2-.3.5-.2.9q0 .6.5 1c.3.4.7.7 1 .7q.7.2 1-.1l1.7-1v9.7q0 .4.5.7c.3.3.7.4 1.1.4q.7 0 1.2-.3c.4-.3.5-.5.5-.8V9.7q0-.4-.5-.7-.4-.3-1.2-.3"/>',
|
|
112
120
|
openCollective:
|
|
113
121
|
'<path d="M21.86 5.17a11.94 11.94 0 0 1 0 13.66l-3.1-3.1a7.68 7.68 0 0 0 0-7.46l3.1-3.1Zm-3.03-3.03-3.1 3.1a7.71 7.71 0 1 0 0 13.51l3.1 3.11a12 12 0 1 1 0-19.73Z"/><path d="M21.86 5.17a11.94 11.94 0 0 1 0 13.66l-3.1-3.1a7.68 7.68 0 0 0 0-7.46l3.1-3.1Z"/>',
|
|
122
|
+
blueSky:
|
|
123
|
+
'<path d="M12 10.8c-1-2.1-4-6-6.8-8C2.6 1 1.6 1.3.9 1.6.1 1.9 0 3 0 3.8c0 .7.4 5.6.6 6.4C1.4 13 4.3 14 7 13.6h.4H7c-4 .6-7.4 2-2.8 7 5 5.3 6.8-1 7.8-4.2 1 3.2 2 9.3 7.7 4.3 4.3-4.3 1.2-6.5-2.7-7a9 9 0 0 1-.4-.1h.4c2.7.3 5.6-.6 6.4-3.4.2-.8.6-5.7.6-6.4 0-.7-.1-1.9-.9-2.2-.7-.3-1.7-.7-4.3 1.2-2.8 2-5.7 5.9-6.8 8"/>',
|
|
114
124
|
astro:
|
|
115
125
|
'<path d="M7.233 15.856c-.456 1.5-.132 3.586.948 4.57v-.036l.036-.096c.132-.636.648-1.032 1.309-1.008.612.012.96.336 1.044 1.044.036.264.036.528.048.803v.084c0 .6.168 1.176.504 1.68.3.48.72.851 1.284 1.103l-.024-.048-.024-.096c-.42-1.26-.12-2.135.984-2.879l.336-.227.745-.492a3.647 3.647 0 0 0 1.536-2.603c.06-.456 0-.9-.132-1.331l-.18.12c-1.668.887-3.577 1.2-5.425.84-1.117-.169-2.197-.48-3-1.416l.011-.012ZM2 15.592s3.205-1.559 6.421-1.559l2.437-7.508c.084-.36.348-.6.648-.6.3 0 .552.24.648.612l2.425 7.496c3.816 0 6.421 1.56 6.421 1.56L15.539.72c-.144-.444-.42-.72-.768-.72H8.24c-.348 0-.6.276-.768.72L2 15.592Z"/>',
|
|
126
|
+
alpine: '<path d="m18.7 6 5.3 5.3-5.3 5.3-5.4-5.3L18.7 6zM5.3 6l11 11H5.8L0 11.2 5.3 6z"/>',
|
|
116
127
|
pnpm: '<path d="M0 0v7.5h7.5V0H0Zm8.25 0v7.5h7.498V0H8.25Zm8.25 0v7.5H24V0h-7.5ZM8.25 8.25v7.5h7.498v-7.5H8.25Zm8.25 0v7.5H24v-7.5h-7.5ZM0 16.5V24h7.5v-7.5H0Zm8.25 0V24h7.498v-7.5H8.25Zm8.25 0V24H24v-7.5h-7.5Z"/>',
|
|
117
128
|
biome:
|
|
118
129
|
'<path d="m12 2-5.346 9.259a12.065 12.065 0 0 1 6.326-.22l1.807.427-1.7 7.208-1.81-.427c-2.223-.524-4.36.644-5.263 2.507l-1.672-.809c1.276-2.636 4.284-4.232 7.363-3.505l.848-3.593A10.213 10.213 0 0 0 0 22.785h24L12 2Z"/>',
|
|
@@ -2,13 +2,10 @@
|
|
|
2
2
|
import { logos } from 'virtual:starlight/user-images';
|
|
3
3
|
import config from 'virtual:starlight/user-config';
|
|
4
4
|
import type { Props } from '../props';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { siteTitle } = Astro.props;
|
|
8
|
-
const href = formatPath(Astro.props.locale || '/');
|
|
5
|
+
const { siteTitle, siteTitleHref } = Astro.props;
|
|
9
6
|
---
|
|
10
7
|
|
|
11
|
-
<a {
|
|
8
|
+
<a href={siteTitleHref} class="site-title sl-flex">
|
|
12
9
|
{
|
|
13
10
|
config.logo && logos.dark && (
|
|
14
11
|
<>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
astroExpressiveCode,
|
|
3
3
|
type AstroExpressiveCodeOptions,
|
|
4
|
-
addClassName,
|
|
5
4
|
type CustomConfigPreprocessors,
|
|
6
5
|
} from 'astro-expressive-code';
|
|
6
|
+
import { addClassName } from 'astro-expressive-code/hast';
|
|
7
7
|
import type { AstroIntegration } from 'astro';
|
|
8
8
|
import type { StarlightConfig } from '../../types';
|
|
9
9
|
import type { createTranslationSystemFromFs } from '../../utils/translations-fs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/starlight",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.4",
|
|
4
4
|
"description": "Build beautiful, high-performance documentation websites with Astro",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -181,9 +181,9 @@
|
|
|
181
181
|
"@astrojs/markdown-remark": "^4.2.1",
|
|
182
182
|
"@playwright/test": "^1.43.1",
|
|
183
183
|
"@types/node": "^18.16.19",
|
|
184
|
-
"@vitest/coverage-v8": "^1.
|
|
184
|
+
"@vitest/coverage-v8": "^1.6.0",
|
|
185
185
|
"astro": "^4.3.5",
|
|
186
|
-
"vitest": "^1.
|
|
186
|
+
"vitest": "^1.6.0"
|
|
187
187
|
},
|
|
188
188
|
"dependencies": {
|
|
189
189
|
"@astrojs/mdx": "^2.1.1",
|
|
@@ -201,6 +201,7 @@
|
|
|
201
201
|
"mdast-util-to-markdown": "^2.1.0",
|
|
202
202
|
"pagefind": "^1.0.3",
|
|
203
203
|
"rehype": "^13.0.1",
|
|
204
|
+
"rehype-format": "^5.0.0",
|
|
204
205
|
"remark-directive": "^3.0.0",
|
|
205
206
|
"unified": "^11.0.4",
|
|
206
207
|
"unist-util-visit": "^5.0.0",
|
package/schemas/social.ts
CHANGED
|
@@ -28,6 +28,8 @@ export const socialLinks = [
|
|
|
28
28
|
'slack',
|
|
29
29
|
'matrix',
|
|
30
30
|
'openCollective',
|
|
31
|
+
'hackerOne',
|
|
32
|
+
'blueSky',
|
|
31
33
|
] as const;
|
|
32
34
|
|
|
33
35
|
export const SocialLinksSchema = () =>
|
|
@@ -71,6 +73,8 @@ export const SocialLinksSchema = () =>
|
|
|
71
73
|
slack: 'Slack',
|
|
72
74
|
matrix: 'Matrix',
|
|
73
75
|
openCollective: 'Open Collective',
|
|
76
|
+
hackerOne: 'Hacker One',
|
|
77
|
+
blueSky: 'BlueSky',
|
|
74
78
|
}[key];
|
|
75
79
|
labelledLinks[key] = { label, url };
|
|
76
80
|
}
|
package/style/markdown.css
CHANGED
package/translations/tr.json
CHANGED
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"page.lastUpdated": "Son güncelleme:",
|
|
19
19
|
"page.previousLink": "Önceki",
|
|
20
20
|
"page.nextLink": "Sonraki",
|
|
21
|
-
"page.draft": "
|
|
21
|
+
"page.draft": "Bu içerik taslaktır ve canlı sürümde bulunmayacaktır.",
|
|
22
22
|
"404.text": "Sayfa bulunamadı. URL'i kontrol edin ya da arama çubuğunu kullanmayı deneyin.",
|
|
23
|
-
"aside.note": "
|
|
24
|
-
"aside.tip": "
|
|
25
|
-
"aside.caution": "
|
|
26
|
-
"aside.danger": "
|
|
27
|
-
"fileTree.directory": "
|
|
23
|
+
"aside.note": "Not",
|
|
24
|
+
"aside.tip": "İpucu",
|
|
25
|
+
"aside.caution": "Dikkat",
|
|
26
|
+
"aside.danger": "Tehlike",
|
|
27
|
+
"fileTree.directory": "Dizin"
|
|
28
28
|
}
|
package/translations/vi.json
CHANGED
|
@@ -65,6 +65,7 @@ const { html, panels } = processPanels(panelHtml);
|
|
|
65
65
|
border-bottom: 2px solid var(--sl-color-gray-5);
|
|
66
66
|
color: var(--sl-color-gray-3);
|
|
67
67
|
outline-offset: var(--sl-outline-offset-inside);
|
|
68
|
+
overflow-wrap: initial;
|
|
68
69
|
}
|
|
69
70
|
.tab [role='tab'][aria-selected='true'] {
|
|
70
71
|
color: var(--sl-color-white);
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { AstroError } from 'astro/errors';
|
|
2
2
|
import type { Element, Root } from 'hast';
|
|
3
3
|
import { rehype } from 'rehype';
|
|
4
|
+
import rehypeFormat from 'rehype-format';
|
|
5
|
+
import type { VFile } from 'vfile';
|
|
6
|
+
|
|
7
|
+
const prettyPrintProcessor = rehype().data('settings', { fragment: true }).use(rehypeFormat);
|
|
8
|
+
const prettyPrintHtml = (html: string) =>
|
|
9
|
+
prettyPrintProcessor.processSync({ value: html }).toString();
|
|
4
10
|
|
|
5
11
|
const stepsProcessor = rehype()
|
|
6
12
|
.data('settings', { fragment: true })
|
|
7
13
|
.use(function steps() {
|
|
8
|
-
return (tree: Root) => {
|
|
14
|
+
return (tree: Root, vfile: VFile) => {
|
|
9
15
|
const rootElements = tree.children.filter((item): item is Element => item.type === 'element');
|
|
10
16
|
const [rootElement] = rootElements;
|
|
11
17
|
|
|
@@ -17,12 +23,14 @@ const stepsProcessor = rehype()
|
|
|
17
23
|
throw new StepsError(
|
|
18
24
|
'The `<Steps>` component expects its content to be a single ordered list (`<ol>`) but found multiple child elements: ' +
|
|
19
25
|
rootElements.map((element: Element) => `\`<${element.tagName}>\``).join(', ') +
|
|
20
|
-
'.'
|
|
26
|
+
'.',
|
|
27
|
+
vfile.value.toString()
|
|
21
28
|
);
|
|
22
29
|
} else if (rootElement.tagName !== 'ol') {
|
|
23
30
|
throw new StepsError(
|
|
24
31
|
'The `<Steps>` component expects its content to be a single ordered list (`<ol>`) but found the following element: ' +
|
|
25
|
-
`\`<${rootElement.tagName}
|
|
32
|
+
`\`<${rootElement.tagName}>\`.`,
|
|
33
|
+
vfile.value.toString()
|
|
26
34
|
);
|
|
27
35
|
}
|
|
28
36
|
|
|
@@ -49,10 +57,12 @@ export const processSteps = (html: string | undefined) => {
|
|
|
49
57
|
};
|
|
50
58
|
|
|
51
59
|
class StepsError extends AstroError {
|
|
52
|
-
constructor(message: string) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
constructor(message: string, html?: string) {
|
|
61
|
+
let hint =
|
|
62
|
+
'To learn more about the `<Steps>` component, see https://starlight.astro.build/guides/components/#steps';
|
|
63
|
+
if (html) {
|
|
64
|
+
hint += '\n\nFull HTML passed to `<Steps>`:\n' + prettyPrintHtml(html);
|
|
65
|
+
}
|
|
66
|
+
super(message, hint);
|
|
57
67
|
}
|
|
58
68
|
}
|
package/utils/route-data.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { ensureTrailingSlash } from './path';
|
|
|
9
9
|
import type { Route } from './routing';
|
|
10
10
|
import { localizedId } from './slugs';
|
|
11
11
|
import { useTranslations } from './translations';
|
|
12
|
+
import { formatPath } from './format-path';
|
|
12
13
|
|
|
13
14
|
export interface PageProps extends Route {
|
|
14
15
|
headings: MarkdownHeading[];
|
|
@@ -17,6 +18,8 @@ export interface PageProps extends Route {
|
|
|
17
18
|
export interface StarlightRouteData extends Route {
|
|
18
19
|
/** Title of the site. */
|
|
19
20
|
siteTitle: string;
|
|
21
|
+
/** URL or path used as the link when clicking on the site title. */
|
|
22
|
+
siteTitleHref: string;
|
|
20
23
|
/** Array of Markdown headings extracted from the current page. */
|
|
21
24
|
headings: MarkdownHeading[];
|
|
22
25
|
/** Site navigation sidebar entries for this page. */
|
|
@@ -48,6 +51,7 @@ export function generateRouteData({
|
|
|
48
51
|
return {
|
|
49
52
|
...props,
|
|
50
53
|
siteTitle,
|
|
54
|
+
siteTitleHref: getSiteTitleHref(locale),
|
|
51
55
|
sidebar,
|
|
52
56
|
hasSidebar: entry.data.template !== 'splash',
|
|
53
57
|
pagination: getPrevNextLinks(sidebar, config.pagination, entry.data),
|
|
@@ -118,3 +122,7 @@ export function getSiteTitle(lang: string): string {
|
|
|
118
122
|
}
|
|
119
123
|
return config.title[defaultLang] as string;
|
|
120
124
|
}
|
|
125
|
+
|
|
126
|
+
export function getSiteTitleHref(locale: string | undefined): string {
|
|
127
|
+
return formatPath(locale || '/');
|
|
128
|
+
}
|
package/utils/starlight-page.ts
CHANGED
|
@@ -3,7 +3,13 @@ import { type ContentConfig, type SchemaContext } from 'astro:content';
|
|
|
3
3
|
import config from 'virtual:starlight/user-config';
|
|
4
4
|
import { parseWithFriendlyErrors } from './error-map';
|
|
5
5
|
import { stripLeadingAndTrailingSlashes } from './path';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
getSiteTitle,
|
|
8
|
+
getSiteTitleHref,
|
|
9
|
+
getToC,
|
|
10
|
+
type PageProps,
|
|
11
|
+
type StarlightRouteData,
|
|
12
|
+
} from './route-data';
|
|
7
13
|
import type { StarlightDocsEntry } from './routing';
|
|
8
14
|
import { slugToLocaleData, urlToSlug } from './slugs';
|
|
9
15
|
import { getPrevNextLinks, getSidebar } from './navigation';
|
|
@@ -224,6 +230,7 @@ export async function generateStarlightPageRouteData({
|
|
|
224
230
|
pagination: getPrevNextLinks(sidebar, config.pagination, entry.data),
|
|
225
231
|
sidebar,
|
|
226
232
|
siteTitle: getSiteTitle(localeData.lang),
|
|
233
|
+
siteTitleHref: getSiteTitleHref(localeData.locale),
|
|
227
234
|
slug,
|
|
228
235
|
toc: getToC({
|
|
229
236
|
...routeProps,
|