Quartz's default table of contents plugin.
  • TypeScript 94.1%
  • SCSS 5.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-09 23:05:14 +01:00
.changeset chore: version package 2026-11-09 04:12:13 +00:00
.github/workflows ci: run ci.yml on the changesets version PR and report it as a commit status 2026-11-09 03:47:26 +01:00
src fix(toc): take entry slugs from the headings' ids (table-of-contents#3) 2026-11-08 19:28:16 +01:00
test fix(toc): take entry slugs from the headings' ids (table-of-contents#3) 2026-11-08 19:28:16 +01:00
types chore: centralize type declarations and standardize tooling config 2026-03-16 18:55:26 +01:00
.eslintrc.json chore: centralize type declarations and standardize tooling config 2026-03-16 18:55:26 +01:00
.gitignore chore: migrate to npm publishing 2026-07-23 09:07:46 +02:00
.prettierignore chore: centralize type declarations and standardize tooling config 2026-03-16 18:55:26 +01:00
.prettierrc Initial commit 2026-02-09 23:00:25 +01:00
CHANGELOG.md chore: version package 2026-11-09 04:12:13 +00:00
LICENSE Initial commit 2026-02-09 23:00:25 +01:00
package-lock.json chore: version package 2026-11-09 04:12:13 +00:00
package.json chore: version package 2026-11-09 04:12:13 +00:00
README.md docs(readme): Quartz 5.1 — npm install and config, correct options and defaults 2026-11-09 22:57:51 +01:00
tsconfig.build.json fix: use separate tsconfig for DTS build to avoid vitest dependency 2026-03-22 13:12:01 +01:00
tsconfig.json chore: centralize type declarations and standardize tooling config 2026-03-16 18:55:26 +01:00
tsup.config.ts build: keep preact and the other shared packages external (tsup's noExternal overrode them) 2026-11-09 04:49:47 +01:00
vitest.config.ts Initial commit 2026-02-09 23:00:25 +01:00

@quartz-community/table-of-contents

Renders an interactive table of contents for pages. Also includes a transformer that extracts heading structure from markdown.

Installation

npx quartz plugin add @quartz-community/table-of-contents

The table of contents is already in Quartz's default configuration.

Usage

plugins:
  - source: "@quartz-community/table-of-contents"
    enabled: true
    options:
      maxDepth: 3
      layout: modern
    order: 50
    layout:
      position: right
      priority: 30

One plugin entry provides both the transformer that collects the headings and the component that displays them: options takes the options of both, and layout places the component.

For advanced use cases, you can override in TypeScript:

import * as ExternalPlugin from "./.quartz/plugins";

// Transformer
ExternalPlugin.TableOfContentsTransformer({ maxDepth: 3 });

// Component
ExternalPlugin.TableOfContents({ layout: "modern" });

Configuration

Component Options

Option Type Default Description
layout "modern" | "legacy" "modern" The layout style of the table of contents.

Transformer Options

Option Type Default Description
maxDepth number 3 The maximum heading depth to include in the table of contents (1-6).
minEntries number 1 The table of contents is only shown when it has more than this many entries.
showByDefault boolean true Whether to show the table of contents by default. Override per page with the enableToc frontmatter key.
collapseByDefault boolean false Whether to collapse the table of contents by default.

Documentation

See the Quartz documentation for more information.

License

MIT