@astrojs/starlight 0.37.0 → 0.37.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,11 @@
1
1
  # @astrojs/starlight
2
2
 
3
+ ## 0.37.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3603](https://github.com/withastro/starlight/pull/3603) [`30f6e7f`](https://github.com/withastro/starlight/commit/30f6e7fa83ca0a248b1b59d616f55a6f933334a2) Thanks [@delucis](https://github.com/delucis)! - Fixes support for providing an absolute URL to Starlight’s `favicon` configuration option
8
+
3
9
  ## 0.37.0
4
10
 
5
11
  ### Minor Changes
@@ -11,7 +17,14 @@
11
17
  If you want to preserve the previous styling, you can add the following [custom CSS](https://starlight.astro.build/guides/css-and-tailwind/#custom-css-styles) to your site:
12
18
 
13
19
  ```css
14
- p, h1, h2, h3, h4, h5, h6, code {
20
+ p,
21
+ h1,
22
+ h2,
23
+ h3,
24
+ h4,
25
+ h5,
26
+ h6,
27
+ code {
15
28
  overflow-wrap: anywhere;
16
29
  }
17
30
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/starlight",
3
- "version": "0.37.0",
3
+ "version": "0.37.1",
4
4
  "description": "Build beautiful, high-performance documentation websites with Astro",
5
5
  "keywords": [
6
6
  "docs",
package/utils/head.ts CHANGED
@@ -6,6 +6,7 @@ import type { PageProps, RouteDataContext } from './routing/data';
6
6
  import { fileWithBase } from './base';
7
7
  import { formatCanonical } from './canonical';
8
8
  import { localizedUrl } from './localizedUrl';
9
+ import { isAbsoluteUrl } from './url';
9
10
 
10
11
  const HeadSchema = HeadConfigSchema({ source: 'content' });
11
12
 
@@ -46,7 +47,9 @@ export function getHead(
46
47
  tag: 'link',
47
48
  attrs: {
48
49
  rel: 'shortcut icon',
49
- href: fileWithBase(config.favicon.href),
50
+ href: isAbsoluteUrl(config.favicon.href)
51
+ ? config.favicon.href
52
+ : fileWithBase(config.favicon.href),
50
53
  type: config.favicon.type,
51
54
  },
52
55
  },
@@ -29,6 +29,7 @@ import type {
29
29
  SidebarEntry,
30
30
  } from './routing/types';
31
31
  import { localeToLang, localizedId, slugToPathname } from './slugs';
32
+ import { isAbsoluteUrl } from './url';
32
33
  import type { StarlightConfig } from './user-config';
33
34
 
34
35
  const DirKey = Symbol('DirKey');
@@ -124,13 +125,10 @@ function groupFromAutogenerateConfig(
124
125
  };
125
126
  }
126
127
 
127
- /** Check if a string starts with one of `http://` or `https://`. */
128
- const isAbsolute = (link: string) => /^https?:\/\//.test(link);
129
-
130
128
  /** Create a link entry from a manual link item in user config. */
131
129
  function linkFromSidebarLinkItem(item: SidebarLinkItem, locale: string | undefined) {
132
130
  let href = item.link;
133
- if (!isAbsolute(href)) {
131
+ if (!isAbsoluteUrl(href)) {
134
132
  href = ensureLeadingSlash(href);
135
133
  // Inject current locale into link.
136
134
  if (locale) href = '/' + locale + href;
@@ -186,7 +184,7 @@ function makeSidebarLink(
186
184
  badge?: Badge,
187
185
  attrs?: LinkHTMLAttributes
188
186
  ): SidebarLink {
189
- if (!isAbsolute(href)) {
187
+ if (!isAbsoluteUrl(href)) {
190
188
  href = formatPath(href);
191
189
  }
192
190
  return makeLink({ label, href, badge, attrs });
package/utils/url.ts ADDED
@@ -0,0 +1,4 @@
1
+ const HTTPProtocolRegEx = /^https?:\/\//;
2
+
3
+ /** Check if a string starts with one of `http://` or `https://`. */
4
+ export const isAbsoluteUrl = (link: string) => HTTPProtocolRegEx.test(link);