@astrojs/starlight 0.25.0 → 0.25.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,20 @@
1
1
  # @astrojs/starlight
2
2
 
3
+ ## 0.25.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2122](https://github.com/withastro/starlight/pull/2122) [`359a642`](https://github.com/withastro/starlight/commit/359a64219288795936f18fd50fb5f195c412a748) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes an i18n configuration issue for multilingual sites when using Astro’s `i18n` config with `prefixDefaultLocale` set to `false`.
8
+
9
+ - [#2107](https://github.com/withastro/starlight/pull/2107) [`61e223b`](https://github.com/withastro/starlight/commit/61e223b153cb10958f3fbaa77acf6ac07d982944) Thanks [@sanabel-al-firdaws](https://github.com/sanabel-al-firdaws)! - Updates Arabic UI translations
10
+
11
+ - [#2105](https://github.com/withastro/starlight/pull/2105) [`81f8a2c`](https://github.com/withastro/starlight/commit/81f8a2c9580ec07dd17e2f596b9b1b50fae8237a) Thanks [@delucis](https://github.com/delucis)! - Fixes an edge case in custom pagination link processing
12
+
13
+ Custom link values for `prev`/`next` in page frontmatter are now always used as authored.
14
+ Previously this was not the case in some edge cases such as for the first and final pages in the sidebar.
15
+
16
+ - [#2119](https://github.com/withastro/starlight/pull/2119) [`464685a`](https://github.com/withastro/starlight/commit/464685a3ce33e7ccc8d1d7365935732c87ba95e9) Thanks [@evadecker](https://github.com/evadecker)! - Improves styling of `<hr>`, `<blockquote>`, and `<code>` within asides
17
+
3
18
  ## 0.25.0
4
19
 
5
20
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/starlight",
3
- "version": "0.25.0",
3
+ "version": "0.25.1",
4
4
  "description": "Build beautiful, high-performance documentation websites with Astro",
5
5
  "keywords": [
6
6
  "docs",
@@ -126,16 +126,23 @@
126
126
  .sl-markdown-content th:not([align]):not(:where(.not-content *)) {
127
127
  text-align: start;
128
128
  }
129
- /* Table styles inside asides */
130
- .sl-markdown-content .starlight-aside :is(th, td):not(:where(.not-content *)) {
129
+ /* <table>s, <hr>s, and <blockquote>s inside asides */
130
+ .sl-markdown-content .starlight-aside :is(th, td, hr, blockquote):not(:where(.not-content *)) {
131
131
  border-color: var(--sl-color-gray-4);
132
132
  }
133
133
  @supports (border-color: color-mix(in srgb, var(--sl-color-asides-text-accent) 30%, transparent)) {
134
- .sl-markdown-content .starlight-aside :is(th, td):not(:where(.not-content *)) {
134
+ .sl-markdown-content .starlight-aside :is(th, td, hr, blockquote):not(:where(.not-content *)) {
135
135
  border-color: color-mix(in srgb, var(--sl-color-asides-text-accent) 30%, transparent);
136
136
  }
137
137
  }
138
138
 
139
+ /* <code> inside asides */
140
+ @supports (border-color: color-mix(in srgb, var(--sl-color-asides-text-accent) 12%, transparent)) {
141
+ .sl-markdown-content .starlight-aside code:not(:where(.not-content *)) {
142
+ background-color: color-mix(in srgb, var(--sl-color-asides-text-accent) 12%, transparent);
143
+ }
144
+ }
145
+
139
146
  .sl-markdown-content hr:not(:where(.not-content *)) {
140
147
  border: 0;
141
148
  border-bottom: 1px solid var(--sl-color-hairline);
@@ -13,17 +13,17 @@
13
13
  "sidebarNav.accessibleLabel": "الرئيسية",
14
14
  "tableOfContents.onThisPage": "على هذه الصفحة",
15
15
  "tableOfContents.overview": "نظرة عامة",
16
- "i18n.untranslatedContent": "هذا المحتوى لا يتوفر بلغتك بعد.",
16
+ "i18n.untranslatedContent": "هذا المحتوى غير متوفر بلغتك بعد.",
17
17
  "page.editLink": "عدل الصفحة",
18
- "page.lastUpdated": "اخر تحديث:",
18
+ "page.lastUpdated": "آخر تحديث:",
19
19
  "page.previousLink": "السابق",
20
20
  "page.nextLink": "التالي",
21
- "page.draft": "This content is a draft and will not be included in production builds.",
21
+ "page.draft": "هذا المحتوى مجرد مسودة ولن يظهر في بنيات الإنتاج",
22
22
  "404.text": "الصفحة غير موجودة. تأكد من الرابط أو ابحث بإستعمال شريط البحث.",
23
- "aside.note": "ملحوظة",
23
+ "aside.note": "ملاحظة",
24
24
  "aside.tip": "نصيحة",
25
25
  "aside.caution": "تنبيه",
26
26
  "aside.danger": "تحذير",
27
27
  "fileTree.directory": "Directory",
28
- "builtWithStarlight.label": "Built with Starlight"
28
+ "builtWithStarlight.label": "طوِّر بواسطة Starlight"
29
29
  }
package/utils/i18n.ts CHANGED
@@ -118,11 +118,12 @@ function getStarlightI18nConfig(
118
118
  locales,
119
119
  defaultLocale: {
120
120
  ...inferStarlightLocaleFromAstroLocale(defaultAstroLocale),
121
- locale: isMonolingualWithRootLocale
122
- ? undefined
123
- : isAstroLocaleExtendedConfig(defaultAstroLocale)
124
- ? defaultAstroLocale.codes[0]
125
- : defaultAstroLocale,
121
+ locale:
122
+ isMonolingualWithRootLocale || (isMultilingual && !prefixDefaultLocale)
123
+ ? undefined
124
+ : isAstroLocaleExtendedConfig(defaultAstroLocale)
125
+ ? defaultAstroLocale.codes[0]
126
+ : defaultAstroLocale,
126
127
  },
127
128
  };
128
129
  }
@@ -130,7 +130,7 @@ function linkFromSidebarLinkItem(
130
130
  if (locale) href = '/' + locale + href;
131
131
  }
132
132
  const label = pickLang(item.translations, localeToLang(locale)) || item.label;
133
- return makeLink(href, label, currentPathname, item.badge, item.attrs);
133
+ return makeSidebarLink(href, label, currentPathname, item.badge, item.attrs);
134
134
  }
135
135
 
136
136
  /** Create a link entry from an automatic internal link item in user config. */
@@ -160,11 +160,11 @@ function linkFromInternalSidebarLinkItem(
160
160
  }
161
161
  const label =
162
162
  pickLang(item.translations, localeToLang(locale)) || item.label || entry.entry.data.title;
163
- return makeLink(entry.slug, label, currentPathname, item.badge, item.attrs);
163
+ return makeSidebarLink(entry.slug, label, currentPathname, item.badge, item.attrs);
164
164
  }
165
165
 
166
- /** Create a link entry. */
167
- function makeLink(
166
+ /** Process sidebar link options to create a link entry. */
167
+ function makeSidebarLink(
168
168
  href: string,
169
169
  label: string,
170
170
  currentPathname: string,
@@ -174,10 +174,24 @@ function makeLink(
174
174
  if (!isAbsolute(href)) {
175
175
  href = formatPath(href);
176
176
  }
177
-
178
177
  const isCurrent = pathsMatch(encodeURI(href), currentPathname);
178
+ return makeLink({ label, href, isCurrent, badge, attrs });
179
+ }
179
180
 
180
- return { type: 'link', label, href, isCurrent, badge, attrs: attrs ?? {} };
181
+ /** Create a link entry */
182
+ function makeLink({
183
+ isCurrent = false,
184
+ attrs = {},
185
+ badge = undefined,
186
+ ...opts
187
+ }: {
188
+ label: string;
189
+ href: string;
190
+ isCurrent?: boolean;
191
+ badge?: Badge | undefined;
192
+ attrs?: LinkHTMLAttributes | undefined;
193
+ }): Link {
194
+ return { type: 'link', ...opts, badge, isCurrent, attrs };
181
195
  }
182
196
 
183
197
  /** Test if two paths are equivalent even if formatted differently. */
@@ -240,7 +254,7 @@ function treeify(routes: Route[], baseDir: string): Dir {
240
254
 
241
255
  /** Create a link entry for a given content collection entry. */
242
256
  function linkFromRoute(route: Route, currentPathname: string): Link {
243
- return makeLink(
257
+ return makeSidebarLink(
244
258
  slugToPathname(route.slug),
245
259
  route.entry.data.sidebar.label || route.entry.data.title,
246
260
  currentPathname,
@@ -388,7 +402,7 @@ function applyPrevNextLinkConfig(
388
402
  } else if (config.link && config.label) {
389
403
  // If there is no link and the frontmatter contains both a URL and a label,
390
404
  // create a new link.
391
- return makeLink(config.link, config.label, '');
405
+ return makeLink({ href: config.link, label: config.label });
392
406
  }
393
407
  }
394
408
  // Otherwise, if the global config is enabled, return the generated link if any.