@astrojs/starlight 0.7.1 → 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,29 @@
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
+
13
+ ## 0.7.2
14
+
15
+ ### Patch Changes
16
+
17
+ - [#506](https://github.com/withastro/starlight/pull/506) [`5e3133c`](https://github.com/withastro/starlight/commit/5e3133c42232b201b981cf4b3bc1c3dd56b09fa5) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Improve table of content current item highlight behavior
18
+
19
+ - [#499](https://github.com/withastro/starlight/pull/499) [`fcff49e`](https://github.com/withastro/starlight/commit/fcff49ee4260ad68e80833712e161cbb978a2562) Thanks [@D3vil0p3r](https://github.com/D3vil0p3r)! - Add icons for Instagram
20
+
21
+ - [#502](https://github.com/withastro/starlight/pull/502) [`3c87a16`](https://github.com/withastro/starlight/commit/3c87a16de3c867ad89294a0ea84d63eca2e74d7a) Thanks [@Mrahmani71](https://github.com/Mrahmani71)! - Add Farsi UI translations
22
+
23
+ - [#496](https://github.com/withastro/starlight/pull/496) [`cd28392`](https://github.com/withastro/starlight/commit/cd28392ac73ac0ba1a441328fcd1d65d7d441366) Thanks [@lorenzolewis](https://github.com/lorenzolewis)! - Fix `lastUpdated` date position to be consistent
24
+
25
+ - [#402](https://github.com/withastro/starlight/pull/402) [`d8669b8`](https://github.com/withastro/starlight/commit/d8669b869761ac15d1d611eda7dd94a62ce0fd7a) Thanks [@chopfitzroy](https://github.com/chopfitzroy)! - Fix content sometimes appearing above the mobile table of contents.
26
+
3
27
  ## 0.7.1
4
28
 
5
29
  ### Patch Changes
@@ -48,4 +48,7 @@ const prevNextLinks = getPrevNextLinks(sidebar, config.pagination, {
48
48
  font-size: var(--sl-text-sm);
49
49
  color: var(--sl-color-gray-3);
50
50
  }
51
+ .meta > :global(p:only-child) {
52
+ margin-inline-start: auto;
53
+ }
51
54
  </style>
@@ -82,4 +82,6 @@ export const Icons = {
82
82
  '<path d="M2.5 1 1 4.8v15.4h5.5V23h3.1l3-2.8H17l6-5.7V1H2.6ZM21 13.5l-3.4 3.3H12l-3 2.8v-2.8H4.5V3H21v10.5Zm-3.4-6.8v5.8h-2V6.7h2Zm-5.5 0v5.8h-2V6.7h2Z"/>',
83
83
  microsoftTeams:
84
84
  '<path d="M13.78 7.2a3.63 3.63 0 1 0-4.3-3.68h1.78a2.52 2.52 0 0 1 2.52 2.53V7.2zM7.34 18.8h3.92a2.52 2.52 0 0 0 2.52-2.52V8.37h4.17c.58.01 1.04.5 1.03 1.07v6.45a6.3 6.3 0 0 1-6.14 6.43 6.3 6.3 0 0 1-5.5-3.52zm16.1-14.06a2.51 2.51 0 1 1-5.02 0 2.51 2.51 0 0 1 5.02 0zm-3.36 14.24h-.17c.4-1 .59-2.05.57-3.11V9.46c0-.38-.07-.75-.23-1.09h2.69c.58 0 1.06.48 1.06 1.06v5.65a3.9 3.9 0 0 1-3.9 3.9h-.02z"/><path d="M1.02 5.02h10.24c.56 0 1.02.46 1.02 1.03v10.23a1.02 1.02 0 0 1-1.02 1.02H1.02A1.02 1.02 0 0 1 0 16.28V6.04c0-.56.46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
21
  microsoftTeams: 'Microsoft Teams',
22
+ instagram: 'Instagram',
22
23
  };
23
24
 
24
25
  const links = Object.entries(config.social || {}).filter(([, url]) => Boolean(url)) as [
@@ -35,6 +35,7 @@ const t = useTranslations(locale);
35
35
  <style>
36
36
  nav {
37
37
  position: fixed;
38
+ z-index: var(--sl-z-index-toc);
38
39
  top: calc(var(--sl-nav-height) - 1px);
39
40
  inset-inline: 0;
40
41
  border-top: 1px solid var(--sl-color-gray-5);
@@ -14,7 +14,7 @@ const { toc, isMobile = false, depth = 0 } = Astro.props;
14
14
  {
15
15
  toc.map((heading) => (
16
16
  <li>
17
- <a href={'#' + heading.slug} aria-current={heading.current && 'true'}>
17
+ <a href={'#' + heading.slug}>
18
18
  <span>{heading.text}</span>
19
19
  </a>
20
20
  {heading.children.length > 0 && (
@@ -2,7 +2,6 @@ import type { MarkdownHeading } from 'astro';
2
2
 
3
3
  export interface TocItem extends MarkdownHeading {
4
4
  children: TocItem[];
5
- current?: boolean;
6
5
  }
7
6
 
8
7
  function diveChildren(item: TocItem, depth: number): TocItem[] {
@@ -34,7 +33,7 @@ export function generateToC(
34
33
 
35
34
  for (const heading of headings) {
36
35
  if (toc.length === 0) {
37
- toc.push({ ...heading, children: [], current: true });
36
+ toc.push({ ...heading, children: [] });
38
37
  } else {
39
38
  const lastItemInToc = toc.at(-1)!;
40
39
  if (heading.depth < lastItemInToc.depth) {
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
+ }
@@ -18,6 +18,10 @@ interface Props {
18
18
  </div>
19
19
 
20
20
  <style>
21
+ .main-pane {
22
+ isolation: isolate;
23
+ }
24
+
21
25
  @media (min-width: 72rem) {
22
26
  .right-sidebar-container {
23
27
  order: 2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/starlight",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "Build beautiful, high-performance documentation websites with Astro",
5
5
  "keywords": [
6
6
  "docs",
package/style/props.css CHANGED
@@ -104,6 +104,7 @@
104
104
  --sl-outline-offset-inside: -0.1875rem;
105
105
 
106
106
  /* Global z-index values */
107
+ --sl-z-index-toc: 4;
107
108
  --sl-z-index-menu: 5;
108
109
  --sl-z-index-navbar: 10;
109
110
  --sl-z-index-skiplink: 20;
@@ -0,0 +1,22 @@
1
+ {
2
+ "skipLink.label": "رفتن به محتوا",
3
+ "search.label": "جستجو",
4
+ "search.shortcutLabel": "(برای جستجو / را فشار دهید)",
5
+ "search.cancelLabel": "لغو",
6
+ "search.devWarning": "جستجو تنها در نسخه‌های تولیدی در دسترس است. \nسعی کنید سایت را بسازید و پیش‌نمایش آن را به صورت محلی آزمایش کنید.",
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
+ }
@@ -5,6 +5,7 @@ import es from './es.json';
5
5
  import de from './de.json';
6
6
  import ja from './ja.json';
7
7
  import pt from './pt.json';
8
+ import fa from './fa.json';
8
9
  import fr from './fr.json';
9
10
  import it from './it.json';
10
11
  import nl from './nl.json';
@@ -13,12 +14,13 @@ import tr from './tr.json';
13
14
  import ar from './ar.json';
14
15
  import nb from './nb.json';
15
16
  import zh from './zh.json';
17
+ import ko from './ko.json';
18
+ import sv from './sv.json';
16
19
 
17
20
  const { parse } = builtinI18nSchema();
18
21
 
19
22
  export default Object.fromEntries(
20
- Object.entries({ cs, en, es, de, ja, pt, fr, it, nl, da, tr, ar, nb, zh }).map(([key, dict]) => [
21
- key,
22
- parse(dict),
23
- ])
23
+ Object.entries({ cs, en, es, de, ja, pt, fa, fr, it, nl, da, tr, ar, nb, zh, ko, sv }).map(
24
+ ([key, dict]) => [key, parse(dict)]
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
+ }
@@ -147,6 +147,7 @@ const UserConfigSchema = z.object({
147
147
  'linkedin',
148
148
  'twitch',
149
149
  'microsoftTeams',
150
+ 'instagram',
150
151
  ]),
151
152
  // Link to the respective social profile for this site
152
153
  z.string().url()