Skip to content

Commit 299ee8c

Browse files
[Docs Site] Bump @astrojs/starlight from 0.28.3 to 0.29.2 (#18281)
* [Docs Site] Bump @astrojs/starlight from 0.28.3 to 0.29.2 Bumps [@astrojs/starlight](https://github.com/withastro/starlight/tree/HEAD/packages/starlight) from 0.28.3 to 0.29.2. - [Release notes](https://github.com/withastro/starlight/releases) - [Changelog](https://github.com/withastro/starlight/blob/main/packages/starlight/CHANGELOG.md) - [Commits](https://github.com/withastro/starlight/commits/@astrojs/[email protected]/packages/starlight) --- updated-dependencies: - dependency-name: "@astrojs/starlight" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * remove patch, pass locals to Container API --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kian Newman-Hazel <[email protected]>
1 parent afa68a9 commit 299ee8c

File tree

10 files changed

+63
-76
lines changed

10 files changed

+63
-76
lines changed

package-lock.json

Lines changed: 45 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"@astrojs/react": "^3.6.2",
3131
"@astrojs/rss": "^4.0.9",
3232
"@astrojs/sitemap": "^3.2.1",
33-
"@astrojs/starlight": "^0.28.3",
33+
"@astrojs/starlight": "^0.29.2",
3434
"@astrojs/starlight-docsearch": "^0.2.0",
3535
"@astrojs/starlight-tailwind": "^2.0.3",
3636
"@astrojs/tailwind": "^5.1.2",

patches/@astrojs+starlight+0.28.3.patch

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/components/ProductChangelog.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ if (!changelogs) {
8080
`Changelog entry points to ${link.slice(1, -1)} but unable to find entry with that slug`,
8181
);
8282

83-
description = (await entryToString(page)) ?? page.body;
83+
description = (await entryToString(page, Astro.locals)) ?? page.body;
8484

8585
return (
8686
<div data-product={entry.product.toLowerCase()}>

src/components/overrides/Head.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ if (currentSection) {
6161
Astro.props.entry.data.description ??= await getPageDescription(
6262
// @ts-expect-error TODO: improve types
6363
Astro.props.entry,
64+
Astro.locals,
6465
);
6566
6667
// Adding metadata used for reporting and search indexing

src/components/overrides/PageSidebar.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ let rangeBetween = (x: number, y: number) =>
1212
if (Astro.props.toc) {
1313
const text = await entryToString(
1414
Astro.props.entry as CollectionEntry<"docs">,
15+
Astro.locals,
1516
);
1617
1718
if (text) {

src/pages/[...changelog].xml.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ export const GET: APIRoute = async (context) => {
7979
`Changelog entry points to ${link.slice(1, -1)} but unable to find entry with that slug`,
8080
);
8181

82-
description = (await entryToString(page)) ?? page.body;
82+
description =
83+
(await entryToString(page, context.locals)) ?? page.body;
8384
} else {
8485
description = entry.description;
8586
}

src/pages/changelog/index/index.xml.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ export const GET: APIRoute = async (context) => {
4040
`Changelog entry points to ${link.slice(1, -1)} but unable to find entry with that slug`,
4141
);
4242

43-
description = (await entryToString(page)) ?? page.body;
43+
description =
44+
(await entryToString(page, context.locals)) ?? page.body;
4445
} else {
4546
description = entry.description;
4647
}

src/util/container.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { getContainerRenderer } from "@astrojs/mdx";
33
import { loadRenderers } from "astro:container";
44
import type { CollectionEntry } from "astro:content";
55

6-
export async function entryToString(entry: CollectionEntry<"docs">) {
6+
export async function entryToString(
7+
entry: CollectionEntry<"docs">,
8+
locals: any,
9+
) {
710
if (!entry.render) {
811
return undefined;
912
}
@@ -17,6 +20,7 @@ export async function entryToString(entry: CollectionEntry<"docs">) {
1720

1821
const html = await container.renderToString(Content, {
1922
params: { slug: entry.slug },
23+
locals,
2024
});
2125

2226
return html;

src/util/description.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ import { entryToString } from "./container";
66
2. If there is a `<p>...</p>` element in the HTML, return that.
77
3. Return `undefined` to signal to consumers there is no suitable description.
88
*/
9-
export async function getPageDescription(entry: CollectionEntry<"docs">) {
9+
export async function getPageDescription(
10+
entry: CollectionEntry<"docs">,
11+
locals: any,
12+
) {
1013
if (entry.data.description) return entry.data.description;
1114

12-
const html = await entryToString(entry);
15+
const html = await entryToString(entry, locals);
1316

1417
if (!html) return undefined;
1518

0 commit comments

Comments
 (0)