Quartz's default syntax highlighting plugin.
  • TypeScript 95.7%
  • SCSS 4.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-09 23:05:07 +01:00
.changeset chore: version package 2026-11-09 04:12:04 +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:25 +01:00
src fix: pack shiki 2026-04-28 00:02:48 +02: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:44 +02:00
.prettierignore chore: centralize type declarations and standardize tooling config 2026-03-16 18:55:26 +01:00
.prettierrc Initial commit 2026-02-13 21:36:52 +01:00
CHANGELOG.md chore: version package 2026-11-09 04:12:04 +00:00
LICENSE Initial commit 2026-02-13 21:36:52 +01:00
package-lock.json chore: version package 2026-11-09 04:12:04 +00:00
package.json chore: version package 2026-11-09 04:12:04 +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 feat: add clipboard copy button for code blocks 2026-02-14 00:32:49 +01:00
tsup.config.ts build: keep preact and the other shared packages external (tsup's noExternal overrode them) 2026-11-09 04:51:42 +01:00
vitest.config.ts fix: add passWithNoTests to vitest config 2026-03-09 03:21:30 +01:00

@quartz-community/syntax-highlighting

Adds syntax highlighting to code blocks using rehype-pretty-code and Shiki, with an optional clipboard copy button.

Installation

npx quartz plugin add @quartz-community/syntax-highlighting

Syntax highlighting is already in Quartz's default configuration.

Usage

plugins:
  - source: "@quartz-community/syntax-highlighting"
    enabled: true
    options:
      theme:
        light: github-light
        dark: github-dark
      keepBackground: false
    order: 20

For advanced use cases, you can override in TypeScript:

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

ExternalPlugin.SyntaxHighlighting({
  theme: { light: "github-light", dark: "github-dark" },
  keepBackground: false,
});

Configuration

Option Type Default Description
theme { light: CodeTheme, dark: CodeTheme } { light: "github-light", dark: "github-dark" } The Shiki themes to use in light and dark mode.
keepBackground boolean false Whether to keep the background color of the code block.
clipboard boolean true Whether to add a clipboard copy button to code blocks.
tokenClassification boolean true Adds data-token-type attributes (keyword, string, comment, etc.) to token spans. Enables theme-aware code styling via CSS selectors.

Documentation

See the Quartz documentation for more information.

License

MIT