@astrojs/starlight 0.18.0 → 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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
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
+
3
11
  ## 0.18.0
4
12
 
5
13
  ### Minor Changes
@@ -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.type !== 'containerDirective') {
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.18.0",
3
+ "version": "0.18.1",
4
4
  "description": "Build beautiful, high-performance documentation websites with Astro",
5
5
  "keywords": [
6
6
  "docs",
@@ -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",
@@ -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": "검색 기능은 프로덕션 환경에서만 사용할 수 있습니다.\n사이트를 로컬 환경에서 테스트하기 위해 빌드하고 미리보기(Preview) 하세요.",
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": "주의",