Files
quartz/docs/plugins/SyntaxHighlighting.md
saberzero1 af5246ce33 docs: Quartz 5.1 — upgrade notes, what's new, plugin manifest reference, plugin development, CLI, configuration, features and plugin pages
Audit of the docs against 5.1 (release notes, core source, plugins) and fixes:
- getting-started: 5.0 → 5.1 upgrade section (plugin doctor --fix, line breaks, heading ids, Bases 1.2, permalinks, frontmatter, CI, GFM before OFM), New in 5.1, git pull upstream v5, no redundant install steps
- advanced: new plugin manifest reference (dependencies, defaultOrder, configSchema/optionSchema, deprecated, components…), making plugins (BuildCtx, emitters, page types, peer dependencies, imports), creating components (./components subpath, script loading, render/prefetch contract), capabilities, architecture, paths
- cli: --directory is the content folder; build/sync flags and behaviour (sync force-pushes); plugin add from npm
- configuration, layout, features and plugin pages: nested colors, built-ins, wikilinks/heading anchors, Obsidian compatibility (OFM 2.0), correct defaults and options, Bases 1.2, stacked pages, og-image v5 API; new pages for Excalidraw, TTRPG maps and themes
2026-11-09 22:27:00 +01:00

2.1 KiB

title, description, tags, image, repository, enabled, required
title description tags image repository enabled required
SyntaxHighlighting Syntax highlighting for code blocks.
plugin/transformer
https://images.unsplash.com/photo-1580569214296-5cf2bffc5ccd [quartz-community/syntax-highlighting](https://github.com/quartz-community/syntax-highlighting) true false

This plugin is used to add syntax highlighting to code blocks in Quartz. See syntax highlighting for more information.

Note

For information on how to add, remove or configure plugins, see the configuration#Plugins page.

This plugin accepts the following configuration options:

  • theme: a separate id of one of the themes bundled with Shiki. One for light mode and one for dark mode. Defaults to theme: { light: "github-light", dark: "github-dark" }.
  • keepBackground: If set to true, the background of the Shiki theme will be used. With false (default) the Quartz theme color for background will be used instead.
  • clipboard: Whether to add a copy-to-clipboard button to code blocks. Defaults to true.
  • tokenClassification: Whether to add a data-token-type attribute to each highlighted token (keyword, string, comment, function, property, …), so themes and custom CSS can restyle tokens by kind, e.g. span[data-token-type="keyword"]. The theme's own colours are kept. Defaults to true.

Highlighting is done with rehype-pretty-code, so its other options (such as defaultLang) can be passed too.

In addition, you can further override the colours in the quartz/styles/syntax.scss file.

Default options

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

API

  • Category: Transformer
  • Function name: ExternalPlugin.SyntaxHighlighting().
  • Source: quartz-community/syntax-highlighting
  • Install: npx quartz plugin add @quartz-community/syntax-highlighting (included in the default configuration)