@astrojs/starlight 0.34.2 → 0.34.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/CHANGELOG.md +24 -0
- package/components/SiteTitle.astro +4 -0
- package/integrations/heading-links.ts +25 -4
- package/package.json +1 -1
- package/style/anchor-links.css +3 -0
- package/translations/de.json +3 -3
- package/translations/ko.json +14 -14
- package/translations/vi.json +14 -14
- package/user-components/Card.astro +1 -0
- package/utils/starlight-page.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.34.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3205](https://github.com/withastro/starlight/pull/3205) [`95d124a`](https://github.com/withastro/starlight/commit/95d124ae99f207afd83f305943fa29df32cbbfc9) Thanks [@sgalcheung](https://github.com/sgalcheung)! - Fixes an issue preventing to use the `<StarlightPage>` component when the `docs` content collection that Starlight uses does not exist.
|
|
8
|
+
|
|
9
|
+
- [#3206](https://github.com/withastro/starlight/pull/3206) [`e6ea584`](https://github.com/withastro/starlight/commit/e6ea5848b20afbb654fd6684956336491b974dc7) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes a text selection issue for heading with a clickable anchor link when using double click to select text in Chrome and Safari.
|
|
10
|
+
|
|
11
|
+
- [#3233](https://github.com/withastro/starlight/pull/3233) [`3064c40`](https://github.com/withastro/starlight/commit/3064c40b54227b6309b35b6e44e397fae8f284a4) Thanks [@torn4dom4n](https://github.com/torn4dom4n)! - Updates Vietnamese UI translations.
|
|
12
|
+
|
|
13
|
+
- [#3248](https://github.com/withastro/starlight/pull/3248) [`16c1239`](https://github.com/withastro/starlight/commit/16c1239b36346e84b794fab819d6ad7a9854a244) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Prevents [icons in the `<Card>` component](https://starlight.astro.build/components/cards/#add-icons-to-cards) from being shrunk in some narrow viewports.
|
|
14
|
+
|
|
15
|
+
- [#3225](https://github.com/withastro/starlight/pull/3225) [`21b93b8`](https://github.com/withastro/starlight/commit/21b93b8ac1894c5ada99a641e516086ebee6ea37) Thanks [@randomguy-2650](https://github.com/randomguy-2650)! - Updates German UI translations
|
|
16
|
+
|
|
17
|
+
## 0.34.3
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#3058](https://github.com/withastro/starlight/pull/3058) [`274cc06`](https://github.com/withastro/starlight/commit/274cc06112824384771b944f504ab0faab45e2b9) Thanks [@techfg](https://github.com/techfg)! - Fixes display of focus indicator around site title
|
|
22
|
+
|
|
23
|
+
- [#3181](https://github.com/withastro/starlight/pull/3181) [`449c822`](https://github.com/withastro/starlight/commit/449c8229effaab19ece3c0a34e32595809c33cc8) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes an issue where all headings in Markdown and MDX content were rendered with a [clickable anchor link](https://starlight.astro.build/reference/configuration/#headinglinks), even in non-Starlight pages.
|
|
24
|
+
|
|
25
|
+
- [#3168](https://github.com/withastro/starlight/pull/3168) [`ca693fe`](https://github.com/withastro/starlight/commit/ca693feb4b6aa9f26b3d536d284288773b788ac6) Thanks [@jsparkdev](https://github.com/jsparkdev)! - Updates Korean langage support with improvements and missing translations
|
|
26
|
+
|
|
3
27
|
## 0.34.2
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -43,6 +43,10 @@ const { siteTitle, siteTitleHref } = Astro.locals.starlightRoute;
|
|
|
43
43
|
color: var(--sl-color-text-accent);
|
|
44
44
|
text-decoration: none;
|
|
45
45
|
white-space: nowrap;
|
|
46
|
+
min-width: 0;
|
|
47
|
+
}
|
|
48
|
+
span {
|
|
49
|
+
overflow: hidden;
|
|
46
50
|
}
|
|
47
51
|
img {
|
|
48
52
|
height: calc(var(--sl-nav-height) - 2 * var(--sl-nav-pad-y));
|
|
@@ -6,6 +6,7 @@ import { h } from 'hastscript';
|
|
|
6
6
|
import type { Transformer } from 'unified';
|
|
7
7
|
import { SKIP, visit } from 'unist-util-visit';
|
|
8
8
|
import type { HookParameters, StarlightConfig } from '../types';
|
|
9
|
+
import { resolveCollectionPath } from '../utils/collection';
|
|
9
10
|
|
|
10
11
|
const AnchorLinkIcon = h(
|
|
11
12
|
'span',
|
|
@@ -24,10 +25,14 @@ const AnchorLinkIcon = h(
|
|
|
24
25
|
* Add anchor links to headings.
|
|
25
26
|
*/
|
|
26
27
|
export default function rehypeAutolinkHeadings(
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
docsCollectionPath: string,
|
|
29
|
+
useTranslationsForLang: AutolinkHeadingsOptions['useTranslations'],
|
|
30
|
+
absolutePathToLang: AutolinkHeadingsOptions['absolutePathToLang']
|
|
29
31
|
) {
|
|
30
32
|
const transformer: Transformer<Root> = (tree, file) => {
|
|
33
|
+
// If the document is not part of the Starlight docs collection, skip it.
|
|
34
|
+
if (!normalizePath(file.path).startsWith(docsCollectionPath)) return;
|
|
35
|
+
|
|
31
36
|
const pageLang = absolutePathToLang(file.path);
|
|
32
37
|
const t = useTranslationsForLang(pageLang);
|
|
33
38
|
|
|
@@ -67,7 +72,9 @@ export default function rehypeAutolinkHeadings(
|
|
|
67
72
|
|
|
68
73
|
interface AutolinkHeadingsOptions {
|
|
69
74
|
starlightConfig: Pick<StarlightConfig, 'markdown'>;
|
|
70
|
-
astroConfig:
|
|
75
|
+
astroConfig: Pick<AstroConfig, 'srcDir'> & {
|
|
76
|
+
experimental: Pick<AstroConfig['experimental'], 'headingIdCompat'>;
|
|
77
|
+
};
|
|
71
78
|
useTranslations: HookParameters<'config:setup'>['useTranslations'];
|
|
72
79
|
absolutePathToLang: HookParameters<'config:setup'>['absolutePathToLang'];
|
|
73
80
|
}
|
|
@@ -85,10 +92,24 @@ export const starlightAutolinkHeadings = ({
|
|
|
85
92
|
rehypeHeadingIds,
|
|
86
93
|
{ experimentalHeadingIdCompat: astroConfig.experimental?.headingIdCompat },
|
|
87
94
|
],
|
|
88
|
-
rehypeAutolinkHeadings(
|
|
95
|
+
rehypeAutolinkHeadings(
|
|
96
|
+
normalizePath(resolveCollectionPath('docs', astroConfig.srcDir)),
|
|
97
|
+
useTranslations,
|
|
98
|
+
absolutePathToLang
|
|
99
|
+
),
|
|
89
100
|
]
|
|
90
101
|
: [];
|
|
91
102
|
|
|
103
|
+
/**
|
|
104
|
+
* File path separators seems to be inconsistent on Windows when the rehype plugin is used on
|
|
105
|
+
* Markdown vs MDX files.
|
|
106
|
+
* For the time being, we normalize the path to unix style path.
|
|
107
|
+
*/
|
|
108
|
+
const backSlashRegex = /\\/g;
|
|
109
|
+
function normalizePath(path: string) {
|
|
110
|
+
return path.replace(backSlashRegex, '/');
|
|
111
|
+
}
|
|
112
|
+
|
|
92
113
|
// This utility is inlined from https://github.com/syntax-tree/hast-util-heading-rank
|
|
93
114
|
// Copyright (c) 2020 Titus Wormer <tituswormer@gmail.com>
|
|
94
115
|
// MIT License: https://github.com/syntax-tree/hast-util-heading-rank/blob/main/license
|
package/package.json
CHANGED
package/style/anchor-links.css
CHANGED
|
@@ -91,6 +91,9 @@ how we do it.
|
|
|
91
91
|
/* Prevent double or triple clicks from potentially selecting the anchor link a11y text. */
|
|
92
92
|
-webkit-user-select: none;
|
|
93
93
|
user-select: none;
|
|
94
|
+
/* Prevent double clicks on the last word (or single word) of a heading to include an extra new
|
|
95
|
+
line in Chrome and Safari. */
|
|
96
|
+
display: inline-flex;
|
|
94
97
|
}
|
|
95
98
|
|
|
96
99
|
/* Increase clickable area for anchor links with a pseudo element that doesn’t impact layout. */
|
package/translations/de.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"search.label": "Suchen",
|
|
4
4
|
"search.ctrlKey": "Strg",
|
|
5
5
|
"search.cancelLabel": "Abbrechen",
|
|
6
|
-
"search.devWarning": "
|
|
6
|
+
"search.devWarning": "Die Suche ist nur in Produktions-Builds verfügbar. \nVersuche, die Website zu bauen und in der Vorschau anzusehen, um sie lokal zu testen.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Farbschema wählen",
|
|
8
8
|
"themeSelect.dark": "Dunkel",
|
|
9
9
|
"themeSelect.light": "Hell",
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
"page.lastUpdated": "Zuletzt bearbeitet:",
|
|
19
19
|
"page.previousLink": "Vorherige Seite",
|
|
20
20
|
"page.nextLink": "Nächste Seite",
|
|
21
|
-
"page.draft": "
|
|
21
|
+
"page.draft": "Dieser Inhalt ist ein Entwurf und wird nicht in den Produktions-Builds enthalten sein.",
|
|
22
22
|
"404.text": "Seite nicht gefunden. Überprüfe die URL oder nutze die Suchleiste.",
|
|
23
23
|
"aside.note": "Hinweis",
|
|
24
24
|
"aside.tip": "Tipp",
|
|
25
25
|
"aside.caution": "Achtung",
|
|
26
26
|
"aside.danger": "Gefahr",
|
|
27
|
-
"fileTree.directory": "
|
|
27
|
+
"fileTree.directory": "Ordner",
|
|
28
28
|
"builtWithStarlight.label": "Erstellt mit Starlight",
|
|
29
29
|
"heading.anchorLabel": "Abschnitt betitelt „{{title}}“"
|
|
30
30
|
}
|
package/translations/ko.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
{
|
|
2
|
-
"skipLink.label": "
|
|
2
|
+
"skipLink.label": "콘텐츠로 이동",
|
|
3
3
|
"search.label": "검색",
|
|
4
4
|
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "취소",
|
|
6
|
-
"search.devWarning": "검색 기능은 프로덕션
|
|
6
|
+
"search.devWarning": "검색 기능은 프로덕션 빌드에서만 작동합니다. \n로컬에서 테스트하려면 사이트를 빌드하고 미리 보기를 실행하세요.",
|
|
7
7
|
"themeSelect.accessibleLabel": "테마 선택",
|
|
8
|
-
"themeSelect.dark": "
|
|
9
|
-
"themeSelect.light": "
|
|
8
|
+
"themeSelect.dark": "어두운 테마",
|
|
9
|
+
"themeSelect.light": "밝은 테마",
|
|
10
10
|
"themeSelect.auto": "자동",
|
|
11
11
|
"languageSelect.accessibleLabel": "언어 선택",
|
|
12
12
|
"menuButton.accessibleLabel": "메뉴",
|
|
13
13
|
"sidebarNav.accessibleLabel": "메인",
|
|
14
|
-
"tableOfContents.onThisPage": "
|
|
14
|
+
"tableOfContents.onThisPage": "목차",
|
|
15
15
|
"tableOfContents.overview": "개요",
|
|
16
|
-
"i18n.untranslatedContent": "이 콘텐츠는 아직
|
|
17
|
-
"page.editLink": "페이지
|
|
16
|
+
"i18n.untranslatedContent": "이 콘텐츠는 아직 번역되지 않았습니다.",
|
|
17
|
+
"page.editLink": "페이지 편집",
|
|
18
18
|
"page.lastUpdated": "마지막 업데이트:",
|
|
19
|
-
"page.previousLink": "이전",
|
|
20
|
-
"page.nextLink": "다음",
|
|
21
|
-
"page.draft": "이 콘텐츠는
|
|
22
|
-
"404.text": "페이지를 찾을 수 없습니다. URL을
|
|
23
|
-
"aside.note": "
|
|
19
|
+
"page.previousLink": "이전 페이지",
|
|
20
|
+
"page.nextLink": "다음 페이지",
|
|
21
|
+
"page.draft": "이 콘텐츠는 아직 초안 상태이며, 최종 빌드에는 포함되지 않습니다.",
|
|
22
|
+
"404.text": "페이지를 찾을 수 없습니다. URL을 다시 확인해보거나 검색을 사용해보세요.",
|
|
23
|
+
"aside.note": "참고",
|
|
24
24
|
"aside.tip": "팁",
|
|
25
25
|
"aside.caution": "주의",
|
|
26
26
|
"aside.danger": "위험",
|
|
27
27
|
"fileTree.directory": "디렉터리",
|
|
28
|
-
"builtWithStarlight.label": "Starlight로
|
|
29
|
-
"heading.anchorLabel": "
|
|
28
|
+
"builtWithStarlight.label": "이 웹사이트는 Starlight로 제작되었습니다.",
|
|
29
|
+
"heading.anchorLabel": "섹션 제목: “{{title}}”"
|
|
30
30
|
}
|
package/translations/vi.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"skipLink.label": "Bỏ qua nội dung",
|
|
2
|
+
"skipLink.label": "Bỏ qua để đến nội dung",
|
|
3
3
|
"search.label": "Tìm kiếm",
|
|
4
4
|
"search.ctrlKey": "Ctrl",
|
|
5
|
-
"search.cancelLabel": "
|
|
6
|
-
"search.devWarning": "
|
|
5
|
+
"search.cancelLabel": "Hủy",
|
|
6
|
+
"search.devWarning": "Chức năng tìm kiếm chỉ có sẵn trong các phiên bản thật.\nHãy thử xây dựng và xem trước trang web để kiểm tra.",
|
|
7
7
|
"themeSelect.accessibleLabel": "Chọn giao diện",
|
|
8
8
|
"themeSelect.dark": "Tối",
|
|
9
9
|
"themeSelect.light": "Sáng",
|
|
@@ -11,20 +11,20 @@
|
|
|
11
11
|
"languageSelect.accessibleLabel": "Chọn ngôn ngữ",
|
|
12
12
|
"menuButton.accessibleLabel": "Menu",
|
|
13
13
|
"sidebarNav.accessibleLabel": "Chính",
|
|
14
|
-
"tableOfContents.onThisPage": "
|
|
15
|
-
"tableOfContents.overview": "Tổng
|
|
16
|
-
"i18n.untranslatedContent": "Nội dung này
|
|
14
|
+
"tableOfContents.onThisPage": "Trên trang này",
|
|
15
|
+
"tableOfContents.overview": "Tổng quan",
|
|
16
|
+
"i18n.untranslatedContent": "Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.",
|
|
17
17
|
"page.editLink": "Chỉnh sửa trang",
|
|
18
18
|
"page.lastUpdated": "Cập nhật lần cuối:",
|
|
19
|
-
"page.previousLink": "
|
|
20
|
-
"page.nextLink": "
|
|
21
|
-
"page.draft": "
|
|
22
|
-
"404.text": "Không tìm thấy trang.
|
|
19
|
+
"page.previousLink": "Trước",
|
|
20
|
+
"page.nextLink": "Tiếp",
|
|
21
|
+
"page.draft": "Nội dung này là bản nháp và sẽ không được đưa vào các phiên bản thật.",
|
|
22
|
+
"404.text": "Không tìm thấy trang. Hãy kiểm tra lại URL hoặc thử dùng thanh tìm kiếm.",
|
|
23
23
|
"aside.note": "Ghi chú",
|
|
24
24
|
"aside.tip": "Mẹo",
|
|
25
|
-
"aside.caution": "
|
|
25
|
+
"aside.caution": "Chú ý",
|
|
26
26
|
"aside.danger": "Nguy hiểm",
|
|
27
|
-
"fileTree.directory": "
|
|
28
|
-
"builtWithStarlight.label": "
|
|
29
|
-
"heading.anchorLabel": "
|
|
27
|
+
"fileTree.directory": "Thư mục",
|
|
28
|
+
"builtWithStarlight.label": "Được xây dựng bằng Starlight",
|
|
29
|
+
"heading.anchorLabel": "Phần tiêu đề “{{title}}”"
|
|
30
30
|
}
|
package/utils/starlight-page.ts
CHANGED
|
@@ -211,5 +211,5 @@ async function getUserDocsSchema(): Promise<
|
|
|
211
211
|
NonNullable<ContentConfig['collections']['docs']['schema']>
|
|
212
212
|
> {
|
|
213
213
|
const userCollections = (await import('virtual:starlight/collection-config')).collections;
|
|
214
|
-
return userCollections?.docs
|
|
214
|
+
return userCollections?.docs?.schema ?? docsSchema();
|
|
215
215
|
}
|