@astrojs/starlight 0.25.0 → 0.25.2
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 +23 -0
- package/components/Icons.ts +2 -0
- package/integrations/asides.ts +8 -7
- package/package.json +2 -1
- package/schemas/social.ts +2 -0
- package/style/markdown.css +10 -3
- package/translations/ar.json +5 -5
- package/utils/i18n.ts +6 -5
- package/utils/navigation.ts +22 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.25.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2126](https://github.com/withastro/starlight/pull/2126) [`ada51ee`](https://github.com/withastro/starlight/commit/ada51ee1500d07c1819059f57e97dc6e97b4d2ba) Thanks [@essential-randomness](https://github.com/essential-randomness)! - Adds support for markdown formatting in aside titles
|
|
8
|
+
|
|
9
|
+
- [#2135](https://github.com/withastro/starlight/pull/2135) [`9bbb969`](https://github.com/withastro/starlight/commit/9bbb9690616f79a80f3d286082b2500457bbcae9) Thanks [@oluwatobiss](https://github.com/oluwatobiss)! - Adds Pinterest social icon
|
|
10
|
+
|
|
11
|
+
## 0.25.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#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`.
|
|
16
|
+
|
|
17
|
+
- [#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
|
|
18
|
+
|
|
19
|
+
- [#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
|
|
20
|
+
|
|
21
|
+
Custom link values for `prev`/`next` in page frontmatter are now always used as authored.
|
|
22
|
+
Previously this was not the case in some edge cases such as for the first and final pages in the sidebar.
|
|
23
|
+
|
|
24
|
+
- [#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
|
|
25
|
+
|
|
3
26
|
## 0.25.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
package/components/Icons.ts
CHANGED
|
@@ -125,6 +125,8 @@ export const BuiltInIcons = {
|
|
|
125
125
|
'<path d="M12.102 0h-.081C5.462 0 .13 5.252.001 11.779v.012L.007 24l12.097-.01c6.582-.055 11.897-5.404 11.897-11.995S18.686.056 12.109 0h-.005zM12 18.857h-.015a6.778 6.778 0 0 1-2.94-.666l.041.018-4.345 1.077 1.227-4.018a6.78 6.78 0 0 1-.83-3.27A6.86 6.86 0 1 1 12 18.857z"/>',
|
|
126
126
|
zulip:
|
|
127
127
|
'<path d="M21 19c0 1.7-1.2 3-2.7 3H5.7C4.2 22 3 20.7 3 19a3 3 0 0 1 1.2-2.4l6.7-6c0-.1.3 0 .2.2l-2.5 5s0 .2.2.2h9.5c1.5 0 2.7 1.4 2.7 3Zm0-14a3 3 0 0 1-1.2 2.4l-6.7 6c0 .1-.2 0-.2-.2l2.5-5s0-.2-.2-.2H5.7C4.2 8 3 6.6 3 5c0-1.7 1.2-3 2.7-3h12.6C19.8 2 21 3.3 21 5Z"/>',
|
|
128
|
+
pinterest:
|
|
129
|
+
'<path d="M12 0a12 12 0 0 0-4.4 23.1c0-.9-.2-2.4 0-3.4l1.5-6s-.4-.7-.4-1.7c0-1.7 1-3 2.2-3 1 0 1.5.8 1.5 1.7 0 1-.6 2.6-1 4-.3 1.2.6 2.2 1.8 2.2 2.1 0 3.8-2.2 3.8-5.5 0-2.8-2-4.9-5-4.9a5.2 5.2 0 0 0-5.4 5.2c0 1 .3 2.2.8 2.8.1.1.2.2.1.3l-.3 1.4c0 .2-.2.3-.4.2-1.5-.7-2.4-3-2.4-4.7C4.4 8 7 4.5 12.3 4.5c4.1 0 7.4 3 7.4 6.9 0 4.1-2.6 7.4-6.3 7.4-1.2 0-2.3-.6-2.7-1.3l-.8 2.8c-.2 1-1 2.4-1.5 3.2A12 12 0 1 0 12 0z"/>',
|
|
128
130
|
astro:
|
|
129
131
|
'<path d="M7.233 15.856c-.456 1.5-.132 3.586.948 4.57v-.036l.036-.096c.132-.636.648-1.032 1.309-1.008.612.012.96.336 1.044 1.044.036.264.036.528.048.803v.084c0 .6.168 1.176.504 1.68.3.48.72.851 1.284 1.103l-.024-.048-.024-.096c-.42-1.26-.12-2.135.984-2.879l.336-.227.745-.492a3.647 3.647 0 0 0 1.536-2.603c.06-.456 0-.9-.132-1.331l-.18.12c-1.668.887-3.577 1.2-5.425.84-1.117-.169-2.197-.48-3-1.416l.011-.012ZM2 15.592s3.205-1.559 6.421-1.559l2.437-7.508c.084-.36.348-.6.648-.6.3 0 .552.24.648.612l2.425 7.496c3.816 0 6.421 1.56 6.421 1.56L15.539.72c-.144-.444-.42-.72-.768-.72H8.24c-.348 0-.6.276-.768.72L2 15.592Z"/>',
|
|
130
132
|
alpine: '<path d="m18.7 6 5.3 5.3-5.3 5.3-5.4-5.3L18.7 6zM5.3 6l11 11H5.8L0 11.2 5.3 6z"/>',
|
package/integrations/asides.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type { AstroConfig, AstroIntegration, AstroUserConfig } from 'astro';
|
|
4
4
|
import { h as _h, s as _s, type Properties } from 'hastscript';
|
|
5
|
-
import type { Node, Paragraph as P, Parent, Root } from 'mdast';
|
|
5
|
+
import type { Node, Paragraph as P, Parent, PhrasingContent, Root } from 'mdast';
|
|
6
6
|
import {
|
|
7
7
|
type Directives,
|
|
8
8
|
directiveToMarkdown,
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type LeafDirective,
|
|
11
11
|
} from 'mdast-util-directive';
|
|
12
12
|
import { toMarkdown } from 'mdast-util-to-markdown';
|
|
13
|
+
import { toString } from 'mdast-util-to-string';
|
|
13
14
|
import remarkDirective from 'remark-directive';
|
|
14
15
|
import type { Plugin, Transformer } from 'unified';
|
|
15
16
|
import { visit } from 'unist-util-visit';
|
|
@@ -156,16 +157,16 @@ function remarkAsides(options: AsidesOptions): Plugin<[], Root> {
|
|
|
156
157
|
// prop to <Aside>, so when we find a directive label, we store it for the title prop and
|
|
157
158
|
// remove the paragraph from the container’s children.
|
|
158
159
|
let title = t(`aside.${variant}`);
|
|
160
|
+
let titleNode: PhrasingContent[] = [{ type: 'text', value: title }];
|
|
159
161
|
const firstChild = node.children[0];
|
|
160
162
|
if (
|
|
161
163
|
firstChild?.type === 'paragraph' &&
|
|
162
164
|
firstChild.data &&
|
|
163
|
-
'directiveLabel' in firstChild.data
|
|
165
|
+
'directiveLabel' in firstChild.data &&
|
|
166
|
+
firstChild.children.length > 0
|
|
164
167
|
) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
title = firstGrandChild.value;
|
|
168
|
-
}
|
|
168
|
+
titleNode = firstChild.children;
|
|
169
|
+
title = toString(firstChild.children);
|
|
169
170
|
// The first paragraph contains a directive label, we can safely remove it.
|
|
170
171
|
node.children.splice(0, 1);
|
|
171
172
|
}
|
|
@@ -189,7 +190,7 @@ function remarkAsides(options: AsidesOptions): Plugin<[], Root> {
|
|
|
189
190
|
},
|
|
190
191
|
iconPaths[variant]
|
|
191
192
|
),
|
|
192
|
-
|
|
193
|
+
...titleNode,
|
|
193
194
|
]),
|
|
194
195
|
h('section', { class: 'starlight-aside__content' }, node.children),
|
|
195
196
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/starlight",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.2",
|
|
4
4
|
"description": "Build beautiful, high-performance documentation websites with Astro",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -195,6 +195,7 @@
|
|
|
195
195
|
"hastscript": "^9.0.0",
|
|
196
196
|
"mdast-util-directive": "^3.0.0",
|
|
197
197
|
"mdast-util-to-markdown": "^2.1.0",
|
|
198
|
+
"mdast-util-to-string": "^4.0.0",
|
|
198
199
|
"pagefind": "^1.0.3",
|
|
199
200
|
"rehype": "^13.0.1",
|
|
200
201
|
"rehype-format": "^5.0.0",
|
package/schemas/social.ts
CHANGED
|
@@ -32,6 +32,7 @@ export const socialLinks = [
|
|
|
32
32
|
'blueSky',
|
|
33
33
|
'discourse',
|
|
34
34
|
'zulip',
|
|
35
|
+
'pinterest',
|
|
35
36
|
] as const;
|
|
36
37
|
|
|
37
38
|
export const SocialLinksSchema = () =>
|
|
@@ -79,6 +80,7 @@ export const SocialLinksSchema = () =>
|
|
|
79
80
|
blueSky: 'BlueSky',
|
|
80
81
|
discourse: 'Discourse',
|
|
81
82
|
zulip: 'Zulip',
|
|
83
|
+
pinterest: 'Pinterest',
|
|
82
84
|
}[key];
|
|
83
85
|
labelledLinks[key] = { label, url };
|
|
84
86
|
}
|
package/style/markdown.css
CHANGED
|
@@ -126,16 +126,23 @@
|
|
|
126
126
|
.sl-markdown-content th:not([align]):not(:where(.not-content *)) {
|
|
127
127
|
text-align: start;
|
|
128
128
|
}
|
|
129
|
-
/*
|
|
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);
|
package/translations/ar.json
CHANGED
|
@@ -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": "
|
|
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": "
|
|
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:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
locale:
|
|
122
|
+
isMonolingualWithRootLocale || (isMultilingual && !prefixDefaultLocale)
|
|
123
|
+
? undefined
|
|
124
|
+
: isAstroLocaleExtendedConfig(defaultAstroLocale)
|
|
125
|
+
? defaultAstroLocale.codes[0]
|
|
126
|
+
: defaultAstroLocale,
|
|
126
127
|
},
|
|
127
128
|
};
|
|
128
129
|
}
|
package/utils/navigation.ts
CHANGED
|
@@ -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
|
|
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
|
|
163
|
+
return makeSidebarLink(entry.slug, label, currentPathname, item.badge, item.attrs);
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
/**
|
|
167
|
-
function
|
|
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
|
-
|
|
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
|
|
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.
|