2024-02-23 21:07:53 +01:00
---
2026-03-19 22:18:42 +01:00
title : SyntaxHighlighting
2026-05-24 19:48:32 +02:00
description : Syntax highlighting for code blocks.
2024-02-23 21:07:53 +01:00
tags :
- plugin/transformer
2026-03-19 22:18:42 +01:00
image : https://images.unsplash.com/photo-1580569214296-5cf2bffc5ccd
2026-05-24 20:05:18 +02:00
repository : "[quartz-community/syntax-highlighting](https://github.com/quartz-community/syntax-highlighting)"
2026-05-24 19:46:42 +02:00
enabled : true
required : false
2024-02-23 21:07:53 +01:00
---
This plugin is used to add syntax highlighting to code blocks in Quartz. See [[syntax highlighting]] for more information.
> [!note]
2024-04-03 16:30:41 -04:00
> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
2024-02-23 21:07:53 +01:00
This plugin accepts the following configuration options:
2026-05-22 20:07:48 +02:00
- `theme` : a separate id of one of the [themes bundled with Shikiji ](https://shikiji.netlify.app/themes ). One for light mode and one for dark mode. Defaults to `theme: { light: "github-light", dark: "github-dark" }` .
2024-02-23 21:07:53 +01:00
- `keepBackground` : If set to `true` , the background of the Shikiji theme will be used. With `false` (default) the Quartz theme color for background will be used instead.
2026-05-22 20:07:48 +02:00
- `clipboard` : Whether to add a copy-to-clipboard button to code blocks. Defaults to `true` .
- `tokenClassification` : Whether to add semantic token classification CSS classes to code tokens. Defaults to `true` .
2024-02-23 21:07:53 +01:00
In addition, you can further override the colours in the `quartz/styles/syntax.scss` file.
## API
- Category: Transformer
2026-03-14 18:10:02 +01:00
- Function name: `ExternalPlugin.SyntaxHighlighting()` .
- Source: [`quartz-community/syntax-highlighting` ](https://github.com/quartz-community/syntax-highlighting )
- Install: `npx quartz plugin add github:quartz-community/syntax-highlighting`