From 265fbb3acdd0a6eafb18c4272a552d785ae432f9 Mon Sep 17 00:00:00 2001 From: Kian Newman-Hazel Date: Wed, 21 May 2025 10:51:13 +0100 Subject: [PATCH 1/2] [Docs Site] Remove Container API usage from changelog --- astro.config.ts | 2 ++ src/pages/changelog/index.astro | 13 +++++-------- src/plugins/rehype/shift-headings.ts | 10 +++++++++- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/astro.config.ts b/astro.config.ts index 587850969b97047..24d082ee04f3c63 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -16,6 +16,7 @@ import rehypeMermaid from "./src/plugins/rehype/mermaid.ts"; import rehypeAutolinkHeadings from "./src/plugins/rehype/autolink-headings.ts"; import rehypeExternalLinks from "./src/plugins/rehype/external-links.ts"; import rehypeHeadingSlugs from "./src/plugins/rehype/heading-slugs.ts"; +import rehypeShiftHeadings from "./src/plugins/rehype/shift-headings.ts"; async function autogenSections() { const sections = ( @@ -67,6 +68,7 @@ export default defineConfig({ rehypeAutolinkHeadings, // @ts-expect-error plugins types are outdated but functional rehypeTitleFigure, + rehypeShiftHeadings, ], }, image: { diff --git a/src/pages/changelog/index.astro b/src/pages/changelog/index.astro index 5fb753b2c1b54e8..02435372132ce5e 100644 --- a/src/pages/changelog/index.astro +++ b/src/pages/changelog/index.astro @@ -10,10 +10,8 @@ import { Steps } from "~/components"; import { format } from "date-fns"; import { getChangelogs } from "~/util/changelog"; import { productsByGroup } from "~/util/products"; -import { entryToString } from "~/util/container"; -import { process } from "~/util/rehype"; -import rehypeShiftHeadings from "~/plugins/rehype/shift-headings.ts"; +import { render } from "astro:content"; const notes = await getChangelogs({ filter: (entry) => !entry.data.hidden, @@ -45,8 +43,7 @@ const props = { .map((group) => group[0]) .sort(); - const html = await entryToString(entry, Astro.locals); - const processed = await process(html, [[rehypeShiftHeadings]]); + const { Content } = await render(entry); return (
@@ -80,7 +77,7 @@ const props = {
-

+ @@ -91,7 +88,7 @@ const props = {

diff --git a/src/plugins/rehype/shift-headings.ts b/src/plugins/rehype/shift-headings.ts index 9010d2ec82d204e..d26e53f9a6b0d2c 100644 --- a/src/plugins/rehype/shift-headings.ts +++ b/src/plugins/rehype/shift-headings.ts @@ -3,8 +3,16 @@ import { visit } from "unist-util-visit"; import type { Root, Element } from "hast"; export default function () { - return function (tree: Root) { + return function (tree: Root, file: any) { visit(tree, "element", function (element) { + if ( + !file.history.find((path: string) => + path.includes("/src/content/changelog/"), + ) + ) { + return; + } + const classNames = (element.properties.className as string[]) ?? []; if (classNames.includes("heading-wrapper")) { From 75f7f4349f095ec17dbde880744e1b5d5a36f77f Mon Sep 17 00:00:00 2001 From: Kian Newman-Hazel Date: Wed, 21 May 2025 12:09:11 +0100 Subject: [PATCH 2/2] dont use style prop --- src/pages/changelog/index.astro | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/pages/changelog/index.astro b/src/pages/changelog/index.astro index 02435372132ce5e..92fe9e50a73ec9c 100644 --- a/src/pages/changelog/index.astro +++ b/src/pages/changelog/index.astro @@ -47,7 +47,7 @@ const props = { return (
= 10 }]} data-products={JSON.stringify( productIds.concat( productGroups.map((group) => @@ -55,7 +55,6 @@ const props = { ), ), )} - style={`display: ${idx >= 10 ? "none" : ""}`} >