@astrojs/starlight 0.17.4 → 0.18.1
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 +2 -0
- package/CHANGELOG.md +24 -0
- package/index.astro +2 -0
- package/index.ts +7 -0
- package/integrations/asides.ts +47 -2
- package/package.json +3 -2
- package/translations/ko.json +11 -11
package/404.astro
CHANGED
|
@@ -7,6 +7,8 @@ import { generateRouteData } from './utils/route-data';
|
|
|
7
7
|
import type { StarlightDocsEntry } from './utils/routing';
|
|
8
8
|
import { useTranslations } from './utils/translations';
|
|
9
9
|
|
|
10
|
+
export const prerender = true;
|
|
11
|
+
|
|
10
12
|
const { lang = 'en', dir = 'ltr' } = config.defaultLocale || {};
|
|
11
13
|
let locale = config.defaultLocale?.locale;
|
|
12
14
|
if (locale === 'root') locale = undefined;
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.18.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1487](https://github.com/withastro/starlight/pull/1487) [`6a72bda`](https://github.com/withastro/starlight/commit/6a72bda8c5569e2eda68fdf258ae9b1dc8b320d6) Thanks [@NavyStack](https://github.com/NavyStack)! - Improves Korean UI translations
|
|
8
|
+
|
|
9
|
+
- [#1489](https://github.com/withastro/starlight/pull/1489) [`b0d36de`](https://github.com/withastro/starlight/commit/b0d36de3398d4895603a787b612b1f0747defbdc) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes a potential text rendering issue with text containing colons.
|
|
10
|
+
|
|
11
|
+
## 0.18.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#1454](https://github.com/withastro/starlight/pull/1454) [`1d9ef56`](https://github.com/withastro/starlight/commit/1d9ef567907bed7210e75ab3460f536c0768a87f) Thanks [@Fryuni](https://github.com/Fryuni)! - Makes Starlight compatible with [on-demand server rendering](https://docs.astro.build/en/guides/server-side-rendering/) (sometimes referred to as server-side rendering or SSR).
|
|
16
|
+
|
|
17
|
+
Starlight pages are always prerendered, even when using `output: 'server'`.
|
|
18
|
+
|
|
19
|
+
- [#1454](https://github.com/withastro/starlight/pull/1454) [`1d9ef56`](https://github.com/withastro/starlight/commit/1d9ef567907bed7210e75ab3460f536c0768a87f) Thanks [@Fryuni](https://github.com/Fryuni)! - Enables Astro’s [`experimental.globalRoutePriority`](https://docs.astro.build/en/reference/configuration-reference/#experimentalglobalroutepriority) option and bumps the minimum required Astro version.
|
|
20
|
+
|
|
21
|
+
⚠️ **BREAKING CHANGE** The minimum supported Astro version is now 4.2.7. Upgrade Astro and Starlight together:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npx @astrojs/upgrade
|
|
25
|
+
```
|
|
26
|
+
|
|
3
27
|
## 0.17.4
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/index.astro
CHANGED
package/index.ts
CHANGED
|
@@ -43,11 +43,15 @@ export default function StarlightIntegration({
|
|
|
43
43
|
injectRoute({
|
|
44
44
|
pattern: '404',
|
|
45
45
|
entrypoint: '@astrojs/starlight/404.astro',
|
|
46
|
+
// Ensure page is pre-rendered even when project is on server output mode
|
|
47
|
+
prerender: true,
|
|
46
48
|
});
|
|
47
49
|
}
|
|
48
50
|
injectRoute({
|
|
49
51
|
pattern: '[...slug]',
|
|
50
52
|
entrypoint: '@astrojs/starlight/index.astro',
|
|
53
|
+
// Ensure page is pre-rendered even when project is on server output mode
|
|
54
|
+
prerender: true,
|
|
51
55
|
});
|
|
52
56
|
// Add built-in integrations only if they are not already added by the user through the
|
|
53
57
|
// config or by a plugin.
|
|
@@ -78,6 +82,9 @@ export default function StarlightIntegration({
|
|
|
78
82
|
scopedStyleStrategy: 'where',
|
|
79
83
|
// If not already configured, default to prefetching all links on hover.
|
|
80
84
|
prefetch: config.prefetch ?? { prefetchAll: true },
|
|
85
|
+
experimental: {
|
|
86
|
+
globalRoutePriority: true,
|
|
87
|
+
},
|
|
81
88
|
});
|
|
82
89
|
},
|
|
83
90
|
|
package/integrations/asides.ts
CHANGED
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import type { AstroConfig, AstroUserConfig } from 'astro';
|
|
4
4
|
import { h as _h, s as _s, type Properties } from 'hastscript';
|
|
5
|
-
import type { Paragraph as P, Root } from 'mdast';
|
|
5
|
+
import type { Node, Paragraph as P, Parent, Root } from 'mdast';
|
|
6
|
+
import {
|
|
7
|
+
type Directives,
|
|
8
|
+
directiveToMarkdown,
|
|
9
|
+
type TextDirective,
|
|
10
|
+
type LeafDirective,
|
|
11
|
+
} from 'mdast-util-directive';
|
|
12
|
+
import { toMarkdown } from 'mdast-util-to-markdown';
|
|
6
13
|
import remarkDirective from 'remark-directive';
|
|
7
14
|
import type { Plugin, Transformer } from 'unified';
|
|
8
15
|
import { remove } from 'unist-util-remove';
|
|
@@ -37,6 +44,40 @@ function s(el: string, attrs: Properties = {}, children: any[] = []): P {
|
|
|
37
44
|
};
|
|
38
45
|
}
|
|
39
46
|
|
|
47
|
+
/** Checks if a node is a directive. */
|
|
48
|
+
function isNodeDirective(node: Node): node is Directives {
|
|
49
|
+
return (
|
|
50
|
+
node.type === 'textDirective' ||
|
|
51
|
+
node.type === 'leafDirective' ||
|
|
52
|
+
node.type === 'containerDirective'
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Transforms back directives not handled by Starlight to avoid breaking user content.
|
|
58
|
+
* For example, a user might write `x:y` in the middle of a sentence, where `:y` would be
|
|
59
|
+
* identified as a text directive, which are not used by Starlight, and we definitely want that
|
|
60
|
+
* text to be rendered verbatim in the output.
|
|
61
|
+
*/
|
|
62
|
+
function transformUnhandledDirective(
|
|
63
|
+
node: TextDirective | LeafDirective,
|
|
64
|
+
index: number,
|
|
65
|
+
parent: Parent
|
|
66
|
+
) {
|
|
67
|
+
const textNode = {
|
|
68
|
+
type: 'text',
|
|
69
|
+
value: toMarkdown(node, { extensions: [directiveToMarkdown()] }),
|
|
70
|
+
} as const;
|
|
71
|
+
if (node.type === 'textDirective') {
|
|
72
|
+
parent.children[index] = textNode;
|
|
73
|
+
} else {
|
|
74
|
+
parent.children[index] = {
|
|
75
|
+
type: 'paragraph',
|
|
76
|
+
children: [textNode],
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
40
81
|
/**
|
|
41
82
|
* remark plugin that converts blocks delimited with `:::` into styled
|
|
42
83
|
* asides (a.k.a. “callouts”, “admonitions”, etc.). Depends on the
|
|
@@ -102,7 +143,11 @@ function remarkAsides(options: AsidesOptions): Plugin<[], Root> {
|
|
|
102
143
|
const locale = pathToLocale(file.history[0], options);
|
|
103
144
|
const t = options.useTranslations(locale);
|
|
104
145
|
visit(tree, (node, index, parent) => {
|
|
105
|
-
if (!parent || index === undefined || node
|
|
146
|
+
if (!parent || index === undefined || !isNodeDirective(node)) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (node.type === 'textDirective' || node.type === 'leafDirective') {
|
|
150
|
+
transformUnhandledDirective(node, index, parent);
|
|
106
151
|
return;
|
|
107
152
|
}
|
|
108
153
|
const variant = node.name;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/starlight",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "Build beautiful, high-performance documentation websites with Astro",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"./style/markdown.css": "./style/markdown.css"
|
|
164
164
|
},
|
|
165
165
|
"peerDependencies": {
|
|
166
|
-
"astro": "^4.
|
|
166
|
+
"astro": "^4.2.7"
|
|
167
167
|
},
|
|
168
168
|
"devDependencies": {
|
|
169
169
|
"@astrojs/markdown-remark": "^4.2.1",
|
|
@@ -183,6 +183,7 @@
|
|
|
183
183
|
"hast-util-select": "^6.0.2",
|
|
184
184
|
"hastscript": "^8.0.0",
|
|
185
185
|
"mdast-util-directive": "^3.0.0",
|
|
186
|
+
"mdast-util-to-markdown": "^2.1.0",
|
|
186
187
|
"pagefind": "^1.0.3",
|
|
187
188
|
"rehype": "^13.0.1",
|
|
188
189
|
"remark-directive": "^3.0.0",
|
package/translations/ko.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
|
-
"skipLink.label": "컨텐츠로
|
|
2
|
+
"skipLink.label": "컨텐츠로 건너뛰기",
|
|
3
3
|
"search.label": "검색",
|
|
4
|
-
"search.shortcutLabel": "(
|
|
4
|
+
"search.shortcutLabel": "(검색하려면 / 를 누르세요)",
|
|
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": "이
|
|
16
|
+
"i18n.untranslatedContent": "이 내용은 아직 번역본이 없습니다.",
|
|
17
17
|
"page.editLink": "페이지 수정",
|
|
18
|
-
"page.lastUpdated": "
|
|
19
|
-
"page.previousLink": "이전
|
|
20
|
-
"page.nextLink": "다음
|
|
21
|
-
"404.text": "페이지를 찾을 수 없습니다. URL을 확인하거나
|
|
18
|
+
"page.lastUpdated": "마지막 업데이트:",
|
|
19
|
+
"page.previousLink": "이전",
|
|
20
|
+
"page.nextLink": "다음",
|
|
21
|
+
"404.text": "페이지를 찾을 수 없습니다. URL을 확인하거나 검색 막대를 사용해 보세요.",
|
|
22
22
|
"aside.note": "노트",
|
|
23
23
|
"aside.tip": "팁",
|
|
24
24
|
"aside.caution": "주의",
|