@astrojs/starlight 0.34.5 → 0.34.7

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,17 @@
1
1
  # @astrojs/starlight
2
2
 
3
+ ## 0.34.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3298](https://github.com/withastro/starlight/pull/3298) [`7bd02e3`](https://github.com/withastro/starlight/commit/7bd02e37650da59ed6cdfe275473ae2dac6a2d48) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes a potential issue with [`absolutePathToLang()`](https://starlight.astro.build/reference/plugins/#absolutepathtolang) plugin API not handling paths with spaces correctly.
8
+
9
+ ## 0.34.6
10
+
11
+ ### Patch Changes
12
+
13
+ - [#3293](https://github.com/withastro/starlight/pull/3293) [`88f0d34`](https://github.com/withastro/starlight/commit/88f0d349ee4e8c42bd38adc01031edf4c7b92342) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes an issue preventing to override the slug of a page with the [`slug` frontmatter property](https://starlight.astro.build/reference/frontmatter/#slug) using the `/` value.
14
+
3
15
  ## 0.34.5
4
16
 
5
17
  ### Patch Changes
@@ -1,3 +1,4 @@
1
+ import { pathToFileURL } from 'node:url';
1
2
  import type { AstroConfig } from 'astro';
2
3
  import type { StarlightConfig } from '../../types';
3
4
  import { localeToLang } from './localeToLang';
@@ -16,8 +17,8 @@ export function absolutePathToLang(
16
17
  }
17
18
  ): string {
18
19
  const docsPath = getCollectionPath('docs', astroConfig.srcDir);
19
- // Format path to unix style path.
20
- path = path?.replace(/\\/g, '/');
20
+ // Format path to URL-encoded path.
21
+ path = pathToFileURL(path).pathname;
21
22
  // Ensure that the page path starts with a slash if the docs directory also does,
22
23
  // which makes stripping the docs path in the next step work on Windows, too.
23
24
  if (path && !path.startsWith('/') && docsPath.startsWith('/')) path = '/' + path;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/starlight",
3
- "version": "0.34.5",
3
+ "version": "0.34.7",
4
4
  "description": "Build beautiful, high-performance documentation websites with Astro",
5
5
  "keywords": [
6
6
  "docs",
package/utils/slugs.ts CHANGED
@@ -40,7 +40,7 @@ function localeToDir(locale: string | undefined): 'ltr' | 'rtl' {
40
40
  }
41
41
 
42
42
  export function slugToParam(slug: string): string | undefined {
43
- return slug === 'index' || slug === ''
43
+ return slug === 'index' || slug === '' || slug === '/'
44
44
  ? undefined
45
45
  : slug.endsWith('/index')
46
46
  ? slug.slice(0, -6)