From 101e9946bddd053a42d269e19e35feae46fe4305 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sat, 4 Nov 2023 12:11:42 -0700 Subject: [PATCH 1/2] feat: add collapseByDefault option to TableOfContents (closes #566) --- docs/features/table of contents.md | 1 + quartz/components/TableOfContents.tsx | 4 ++-- quartz/components/scripts/toc.inline.ts | 3 ++- quartz/plugins/transformers/toc.ts | 4 ++++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/features/table of contents.md b/docs/features/table of contents.md index a66c8501705f9..f169b22d27240 100644 --- a/docs/features/table of contents.md +++ b/docs/features/table of contents.md @@ -18,6 +18,7 @@ You can also hide the table of contents on a page by adding `showToc: false` to - Removing table of contents: remove all instances of `Plugin.TableOfContents()` from `quartz.config.ts`. and `Component.TableOfContents()` from `quartz.layout.ts` - Changing the max depth: pass in a parameter to `Plugin.TableOfContents({ maxDepth: 4 })` - Changing the minimum number of entries in the Table of Contents before it renders: pass in a parameter to `Plugin.TableOfContents({ minEntries: 3 })` +- Collapse the table of content by default: pass in a parameter to `Plugin.TableOfContents({ collapseByDefault: true })` - Component: `quartz/components/TableOfContents.tsx` - Style: - Modern (default): `quartz/components/styles/toc.scss` diff --git a/quartz/components/TableOfContents.tsx b/quartz/components/TableOfContents.tsx index 3847726841d62..1c55f0740ae63 100644 --- a/quartz/components/TableOfContents.tsx +++ b/quartz/components/TableOfContents.tsx @@ -20,7 +20,7 @@ function TableOfContents({ fileData, displayClass }: QuartzComponentProps) { return (
-