From 6e27a5fdc21276cad26cd50e16a2709a40a7cbac Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Sat, 23 Jul 2022 17:23:15 -0500 Subject: [PATCH] Rename Markdown util `getHeaders()` to `getHeadings()` (#4031) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Renamed getHeaders() to getHeadings(), according to RFC #208. * chore: update changeset * fix: expose MarkdownHeading type from `astro` Co-authored-by: FĂ©lix Sanz Co-authored-by: Nate Moore --- .changeset/young-radios-call.md | 6 ++++++ .../components/PageContent/PageContent.astro | 4 ++-- .../components/RightSidebar/MoreMenu.astro | 4 ++-- .../RightSidebar/RightSidebar.astro | 4 ++-- .../RightSidebar/TableOfContents.tsx | 16 +++++++-------- examples/docs/src/styles/index.css | 20 +++++++++---------- packages/astro/env.d.ts | 4 +++- packages/astro/src/@types/astro.ts | 14 +++++++++++-- .../astro/src/vite-plugin-markdown/index.ts | 6 +++++- packages/markdown/remark/src/index.ts | 10 +++++----- ...-headers.ts => rehype-collect-headings.ts} | 14 ++++++------- packages/markdown/remark/src/types.ts | 4 ++-- 12 files changed, 64 insertions(+), 42 deletions(-) create mode 100644 .changeset/young-radios-call.md rename packages/markdown/remark/src/{rehype-collect-headers.ts => rehype-collect-headings.ts} (84%) diff --git a/.changeset/young-radios-call.md b/.changeset/young-radios-call.md new file mode 100644 index 000000000..754c363a9 --- /dev/null +++ b/.changeset/young-radios-call.md @@ -0,0 +1,6 @@ +--- +'astro': patch +'@astrojs/markdown-remark': minor +--- + +**BREAKING** Renamed Markdown utility function `getHeaders()` to `getHeadings()`. diff --git a/examples/docs/src/components/PageContent/PageContent.astro b/examples/docs/src/components/PageContent/PageContent.astro index 1d14515c1..11c130b05 100644 --- a/examples/docs/src/components/PageContent/PageContent.astro +++ b/examples/docs/src/components/PageContent/PageContent.astro @@ -4,14 +4,14 @@ import TableOfContents from "../RightSidebar/TableOfContents.tsx"; const { content, githubEditUrl } = Astro.props; const title = content.title; -const headers = content.astro.headers; +const headings = content.astro.headings; ---

{title}

diff --git a/examples/docs/src/components/RightSidebar/MoreMenu.astro b/examples/docs/src/components/RightSidebar/MoreMenu.astro index a78f86d59..9b0e426cf 100644 --- a/examples/docs/src/components/RightSidebar/MoreMenu.astro +++ b/examples/docs/src/components/RightSidebar/MoreMenu.astro @@ -8,7 +8,7 @@ const showMoreSection = CONFIG.COMMUNITY_INVITE_URL || editHref; {showMoreSection &&

More

}
    {editHref && ( -