@astrojs/starlight 0.22.1 → 0.22.3

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 CHANGED
@@ -29,6 +29,7 @@ const fallbackEntry: StarlightDocsEntry = {
29
29
  hero: { tagline: t('404.text'), actions: [] },
30
30
  pagefind: false,
31
31
  sidebar: { hidden: false, attrs: {} },
32
+ draft: false,
32
33
  },
33
34
  render: async () => ({
34
35
  Content: EmptyContent,
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @astrojs/starlight
2
2
 
3
+ ## 0.22.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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
8
+
9
+ - [#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
10
+
11
+ - [#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`
12
+
13
+ - [#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.
14
+
15
+ - [#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`
16
+
17
+ ## 0.22.2
18
+
19
+ ### Patch Changes
20
+
21
+ - [#1811](https://github.com/withastro/starlight/pull/1811) [`fe06aa13`](https://github.com/withastro/starlight/commit/fe06aa1307208ef9f5b249181ec29837f96940c2) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes a `<Tabs>` sync issue when inconsistently using the `icon` prop or not on `<TabItem>` components.
22
+
23
+ - [#1826](https://github.com/withastro/starlight/pull/1826) [`52ea7381`](https://github.com/withastro/starlight/commit/52ea7381e131338a03cffb3499ba1699951cea1e) Thanks [@dragomano](https://github.com/dragomano)! - Updates Russian UI translations
24
+
3
25
  ## 0.22.1
4
26
 
5
27
  ### Patch Changes
@@ -6,9 +6,9 @@ case `uname` in
6
6
  esac
7
7
 
8
8
  if [ -z "$NODE_PATH" ]; then
9
- export NODE_PATH="/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.3.5_@types+node@18.16.19/node_modules/astro/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.3.5_@types+node@18.16.19/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/node_modules"
9
+ export NODE_PATH="/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.3.5_@types+node@18.16.19_typescript@5.4.5/node_modules/astro/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.3.5_@types+node@18.16.19_typescript@5.4.5/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/node_modules"
10
10
  else
11
- export NODE_PATH="/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.3.5_@types+node@18.16.19/node_modules/astro/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.3.5_@types+node@18.16.19/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/node_modules:$NODE_PATH"
11
+ export NODE_PATH="/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.3.5_@types+node@18.16.19_typescript@5.4.5/node_modules/astro/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.3.5_@types+node@18.16.19_typescript@5.4.5/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
14
  exec "$basedir/node" "$basedir/../astro/astro.js" "$@"
@@ -35,3 +35,20 @@ A set of tabs using the `style` sync key.
35
35
  <TabItem label="css">css code</TabItem>
36
36
  <TabItem label="tailwind">tailwind code</TabItem>
37
37
  </Tabs>
38
+
39
+ Another set of tabs using the `pkg` sync key and using icons.
40
+
41
+ <Tabs syncKey="pkg">
42
+ <TabItem label="npm" icon="seti:npm">
43
+ another npm command
44
+ </TabItem>
45
+ <TabItem label="pnpm" icon="pnpm">
46
+ another pnpm command
47
+ </TabItem>
48
+ <TabItem label="bun" icon="bun">
49
+ another bun command
50
+ </TabItem>
51
+ <TabItem label="yarn" icon="seti:yarn">
52
+ another yarn command
53
+ </TabItem>
54
+ </Tabs>
@@ -116,6 +116,29 @@ test('preserves tabs position when alternating between tabs with different conte
116
116
  expect((await tabs.boundingBox())?.y).toBe(initialBoundingBox?.y);
117
117
  });
118
118
 
119
+ test('syncs tabs with the same sync key if they do not consistenly use icons', async ({
120
+ page,
121
+ starlight,
122
+ }) => {
123
+ await starlight.goto('/tabs');
124
+
125
+ const tabs = page.locator('starlight-tabs');
126
+ const pkgTabsA = tabs.nth(0); // This set does not use icons for tab items.
127
+ const pkgTabsB = tabs.nth(4); // This set uses icons for tab items.
128
+
129
+ // Select the pnpm tab in the first set of synced tabs.
130
+ await pkgTabsA.getByRole('tab').filter({ hasText: 'pnpm' }).click();
131
+
132
+ await expectSelectedTab(pkgTabsA, 'pnpm', 'pnpm command');
133
+ await expectSelectedTab(pkgTabsB, 'pnpm', 'another pnpm command');
134
+
135
+ // Select the yarn tab in the second set of synced tabs.
136
+ await pkgTabsB.getByRole('tab').filter({ hasText: 'yarn' }).click();
137
+
138
+ await expectSelectedTab(pkgTabsB, 'yarn', 'another yarn command');
139
+ await expectSelectedTab(pkgTabsA, 'yarn', 'yarn command');
140
+ });
141
+
119
142
  async function expectSelectedTab(tabs: Locator, label: string, panel: string) {
120
143
  expect((await tabs.getByRole('tab', { selected: true }).textContent())?.trim()).toBe(label);
121
144
  expect((await tabs.getByRole('tabpanel').textContent())?.trim()).toBe(panel);
@@ -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;
@@ -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,6 +115,8 @@ 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"/>',
114
122
  astro:
@@ -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
- import { formatPath } from '../utils/format-path';
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 {href} class="site-title sl-flex">
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.1",
3
+ "version": "0.22.3",
4
4
  "description": "Build beautiful, high-performance documentation websites with Astro",
5
5
  "keywords": [
6
6
  "docs",
@@ -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,7 @@ export const socialLinks = [
28
28
  'slack',
29
29
  'matrix',
30
30
  'openCollective',
31
+ 'hackerOne',
31
32
  ] as const;
32
33
 
33
34
  export const SocialLinksSchema = () =>
@@ -71,6 +72,7 @@ export const SocialLinksSchema = () =>
71
72
  slack: 'Slack',
72
73
  matrix: 'Matrix',
73
74
  openCollective: 'Open Collective',
75
+ hackerOne: 'Hacker One',
74
76
  }[key];
75
77
  labelledLinks[key] = { label, url };
76
78
  }
@@ -18,10 +18,10 @@
18
18
  "page.lastUpdated": "Последнее обновление:",
19
19
  "page.previousLink": "Предыдущая",
20
20
  "page.nextLink": "Следующая",
21
- "page.draft": "This content is a draft and will not be included in production builds.",
21
+ "page.draft": "Этот контент является черновиком и не будет добавлен в производственные сборки.",
22
22
  "404.text": "Страница не найдена. Проверьте URL или используйте поиск по сайту.",
23
23
  "aside.note": "Заметка",
24
- "aside.tip": "Знали ли вы?",
24
+ "aside.tip": "Совет",
25
25
  "aside.caution": "Осторожно",
26
26
  "aside.danger": "Опасно",
27
27
  "fileTree.directory": "Директория",
@@ -24,5 +24,5 @@
24
24
  "aside.tip": "Mẹo",
25
25
  "aside.caution": "Thận trọng",
26
26
  "aside.danger": "Nguy hiểm",
27
- "fileTree.directory": "Directory"
27
+ "fileTree.directory": "Danh mục"
28
28
  }
@@ -158,7 +158,7 @@ const { html, panels } = processPanels(panelHtml);
158
158
  newTab.setAttribute('aria-selected', 'true');
159
159
  if (shouldSync) {
160
160
  newTab.focus();
161
- StarlightTabs.#syncTabs(this, newTab.textContent);
161
+ StarlightTabs.#syncTabs(this, newTab.innerText);
162
162
  window.scrollTo({
163
163
  top: window.scrollY + (this.getBoundingClientRect().top - previousTabsOffset),
164
164
  });
@@ -173,7 +173,7 @@ const { html, panels } = processPanels(panelHtml);
173
173
 
174
174
  for (const receiver of syncedTabs) {
175
175
  if (receiver === emitter) continue;
176
- const labelIndex = receiver.tabs.findIndex((tab) => tab.textContent === label);
176
+ const labelIndex = receiver.tabs.findIndex((tab) => tab.innerText === label);
177
177
  if (labelIndex === -1) continue;
178
178
  receiver.switchTab(receiver.tabs[labelIndex], labelIndex, false);
179
179
  }
@@ -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
- super(
54
- message,
55
- 'To learn more about the `<Steps>` component, see https://starlight.astro.build/guides/components/#steps'
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
  }
@@ -34,6 +34,7 @@ function formatPath(
34
34
  href: string,
35
35
  { format = 'directory', trailingSlash = 'ignore' }: FormatPathOptions
36
36
  ) {
37
+ // @ts-expect-error — TODO: add support for `preserve` (https://github.com/withastro/starlight/issues/1781)
37
38
  const formatStrategy = formatStrategies[format];
38
39
  const trailingSlashStrategy = trailingSlashStrategies[trailingSlash];
39
40
 
@@ -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
+ }
@@ -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 { getSiteTitle, getToC, type PageProps, type StarlightRouteData } from './route-data';
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,
@@ -256,7 +256,7 @@ export const StarlightConfigSchema = UserConfigSchema.strict().transform(
256
256
  const defaultLocaleConfig = {
257
257
  label: 'English',
258
258
  lang: 'en',
259
- dir: 'ltr',
259
+ dir: 'ltr' as const,
260
260
  locale: undefined,
261
261
  ...locales?.root,
262
262
  };