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 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 totheme: { light: "github-light", dark: "github-dark" }.keepBackground: If set totrue, the background of the Shiki theme will be used. Withfalse(default) the Quartz theme color for background will be used instead.clipboard: Whether to add a copy-to-clipboard button to code blocks. Defaults totrue.tokenClassification: Whether to add adata-token-typeattribute 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 totrue.
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: 20API
- 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)