@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 +14 -1
- package/package.json +1 -1
- package/utils/head.ts +4 -1
- package/utils/navigation.ts +3 -5
- package/utils/url.ts +4 -0
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,
|
|
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
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:
|
|
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
|
},
|
package/utils/navigation.ts
CHANGED
|
@@ -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 (!
|
|
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 (!
|
|
187
|
+
if (!isAbsoluteUrl(href)) {
|
|
190
188
|
href = formatPath(href);
|
|
191
189
|
}
|
|
192
190
|
return makeLink({ label, href, badge, attrs });
|
package/utils/url.ts
ADDED