@astrojs/starlight 0.7.2 → 0.7.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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @astrojs/starlight
2
2
 
3
+ ## 0.7.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#525](https://github.com/withastro/starlight/pull/525) [`87caf21`](https://github.com/withastro/starlight/commit/87caf21adaac98cf8342dac4db97ace327849616) Thanks [@delucis](https://github.com/delucis)! - Improve inline code and code block support in RTL languages
8
+
9
+ - [#537](https://github.com/withastro/starlight/pull/537) [`56c19bc`](https://github.com/withastro/starlight/commit/56c19bc871f2a4f205d4b0bb833fd81a3ed2e0f0) Thanks [@carlgleisner](https://github.com/carlgleisner)! - Add Swedish UI translations.
10
+
11
+ - [#528](https://github.com/withastro/starlight/pull/528) [`f5e5503`](https://github.com/withastro/starlight/commit/f5e55036987db98dbd0be7a84eb7819a48234a2f) Thanks [@jsparkdev](https://github.com/jsparkdev)! - add Korean language support
12
+
3
13
  ## 0.7.2
4
14
 
5
15
  ### Patch Changes
package/index.ts CHANGED
@@ -8,6 +8,7 @@ import { starlightSitemap } from './integrations/sitemap';
8
8
  import { vitePluginStarlightUserConfig } from './integrations/virtual-user-config';
9
9
  import { errorMap } from './utils/error-map';
10
10
  import { StarlightConfigSchema, StarlightUserConfig } from './utils/user-config';
11
+ import { rehypeRtlCodeSupport } from './integrations/code-rtl-support';
11
12
 
12
13
  export default function StarlightIntegration(opts: StarlightUserConfig): AstroIntegration[] {
13
14
  const parsedConfig = StarlightConfigSchema.safeParse(opts, { errorMap });
@@ -39,6 +40,7 @@ export default function StarlightIntegration(opts: StarlightUserConfig): AstroIn
39
40
  },
40
41
  markdown: {
41
42
  remarkPlugins: [...starlightAsides()],
43
+ rehypePlugins: [rehypeRtlCodeSupport()],
42
44
  shikiConfig:
43
45
  // Configure Shiki theme if the user is using the default github-dark theme.
44
46
  config.markdown.shikiConfig.theme !== 'github-dark' ? {} : { theme: 'css-variables' },
@@ -0,0 +1,31 @@
1
+ import type { Root } from 'hastscript/lib/core';
2
+ import { CONTINUE, SKIP, visit } from 'unist-util-visit';
3
+
4
+ /**
5
+ * rehype plugin that adds `dir` attributes to `<code>` and `<pre>`
6
+ * elements that don’t already have them.
7
+ *
8
+ * `<code>` will become `<code dir="auto">`
9
+ * `<pre>` will become `<pre dir="ltr">`
10
+ *
11
+ * `<code>` _inside_ `<pre>` is skipped, so respects the `ltr` on its parent.
12
+ *
13
+ * Reasoning:
14
+ * - `<pre>` is usually a code block and code should be LTR even in an RTL document
15
+ * - `<code>` is often LTR, but could also be RTL. `dir="auto"` ensures the bidirectional
16
+ * algorithm treats the contents of `<code>` in isolation and gives its best guess.
17
+ */
18
+ export function rehypeRtlCodeSupport() {
19
+ return () => (root: Root) => {
20
+ visit(root, 'element', (el) => {
21
+ if (el.tagName === 'pre' || el.tagName === 'code') {
22
+ el.properties ||= {};
23
+ if (!('dir' in el.properties)) {
24
+ el.properties.dir = { pre: 'ltr', code: 'auto' }[el.tagName];
25
+ }
26
+ return SKIP;
27
+ }
28
+ return CONTINUE;
29
+ });
30
+ };
31
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/starlight",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Build beautiful, high-performance documentation websites with Astro",
5
5
  "keywords": [
6
6
  "docs",
@@ -14,11 +14,13 @@ import tr from './tr.json';
14
14
  import ar from './ar.json';
15
15
  import nb from './nb.json';
16
16
  import zh from './zh.json';
17
+ import ko from './ko.json';
18
+ import sv from './sv.json';
17
19
 
18
20
  const { parse } = builtinI18nSchema();
19
21
 
20
22
  export default Object.fromEntries(
21
- Object.entries({ cs, en, es, de, ja, pt, fa, fr, it, nl, da, tr, ar, nb, zh }).map(
23
+ Object.entries({ cs, en, es, de, ja, pt, fa, fr, it, nl, da, tr, ar, nb, zh, ko, sv }).map(
22
24
  ([key, dict]) => [key, parse(dict)]
23
25
  )
24
26
  );
@@ -0,0 +1,22 @@
1
+ {
2
+ "skipLink.label": "컨텐츠로 이동",
3
+ "search.label": "검색",
4
+ "search.shortcutLabel": "(검색을 위해 / 키를 누르세요)",
5
+ "search.cancelLabel": "취소",
6
+ "search.devWarning": "검색 기능은 프로덕션 환경에서만 사용할 수 있습니다.\n사이트를 로컬 환경에서 테스트하기 위해 빌드하고 미리보기(Preview) 하세요.",
7
+ "themeSelect.accessibleLabel": "테마 선택",
8
+ "themeSelect.dark": "어두움",
9
+ "themeSelect.light": "밝음",
10
+ "themeSelect.auto": "자동",
11
+ "languageSelect.accessibleLabel": "언어 선택",
12
+ "menuButton.accessibleLabel": "메뉴",
13
+ "sidebarNav.accessibleLabel": "메인",
14
+ "tableOfContents.onThisPage": "목차",
15
+ "tableOfContents.overview": "개요",
16
+ "i18n.untranslatedContent": "이 컨텐츠는 아직 번역되지 않았습니다.",
17
+ "page.editLink": "페이지 수정",
18
+ "page.lastUpdated": "최종 수정:",
19
+ "page.previousLink": "이전 페이지",
20
+ "page.nextLink": "다음 페이지",
21
+ "404.text": "페이지를 찾을 수 없습니다. URL을 확인하거나 검색창을 사용해보세요."
22
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "skipLink.label": "Hoppa till innehåll",
3
+ "search.label": "Sök",
4
+ "search.shortcutLabel": "(Tryck / för att söka)",
5
+ "search.cancelLabel": "Avbryt",
6
+ "search.devWarning": "Sökfunktionen är endast tillgänglig i produktionsbyggen. \nProva att bygga och förhandsvisa siten för att testa det lokalt.",
7
+ "themeSelect.accessibleLabel": "Välj tema",
8
+ "themeSelect.dark": "Mörkt",
9
+ "themeSelect.light": "Ljust",
10
+ "themeSelect.auto": "Auto",
11
+ "languageSelect.accessibleLabel": "Välj språk",
12
+ "menuButton.accessibleLabel": "Meny",
13
+ "sidebarNav.accessibleLabel": "Huvudmeny",
14
+ "tableOfContents.onThisPage": "På den här sidan",
15
+ "tableOfContents.overview": "Översikt",
16
+ "i18n.untranslatedContent": "Det här innehållet är inte tillgängligt på ditt språk än.",
17
+ "page.editLink": "Redigera sida",
18
+ "page.lastUpdated": "Senast uppdaterad:",
19
+ "page.previousLink": "Föregående",
20
+ "page.nextLink": "Nästa",
21
+ "404.text": "Sidan hittades inte. Kontrollera URL:n eller testa att använda sökfältet."
22
+ }