@quartz-community/syntax-highlighting 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +7 -4
- package/dist/index.js +347 -1656
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 1.0.4
|
|
2
|
+
|
|
3
|
+
### Patch Changes
|
|
4
|
+
|
|
5
|
+
- 0c82675: The copy button's stylesheet is in Quartz's base layer, so themes (e.g. `@quartz-themes/core`'s `obsidian` layer) can restyle the button; unlayered, it beat every theme rule.
|
|
6
|
+
|
|
7
|
+
## 1.0.3
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- d0a1445: Uses Quartz's own `preact` instead of bundling a second copy (`noExternal` in the build overrode the externals). Components now share one Preact instance with Quartz and other plugins, so hooks and context work across them, and the bundle is smaller.
|
|
12
|
+
|
|
1
13
|
## 1.0.2
|
|
2
14
|
|
|
3
15
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
# @quartz-community/syntax-highlighting
|
|
2
2
|
|
|
3
|
-
Adds syntax highlighting to code blocks using rehype-pretty-code, with an optional clipboard copy button.
|
|
3
|
+
Adds syntax highlighting to code blocks using [rehype-pretty-code](https://rehype-pretty.pages.dev/) and [Shiki](https://shiki.style/), with an optional clipboard copy button.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npx quartz plugin add
|
|
8
|
+
npx quartz plugin add @quartz-community/syntax-highlighting
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
Syntax highlighting is already in Quartz's default configuration.
|
|
12
|
+
|
|
11
13
|
## Usage
|
|
12
14
|
|
|
13
15
|
```yaml title="quartz.config.yaml"
|
|
14
16
|
plugins:
|
|
15
|
-
- source:
|
|
17
|
+
- source: "@quartz-community/syntax-highlighting"
|
|
16
18
|
enabled: true
|
|
17
19
|
options:
|
|
18
20
|
theme:
|
|
19
21
|
light: github-light
|
|
20
22
|
dark: github-dark
|
|
21
23
|
keepBackground: false
|
|
24
|
+
order: 20
|
|
22
25
|
```
|
|
23
26
|
|
|
24
27
|
For advanced use cases, you can override in TypeScript:
|
|
@@ -36,7 +39,7 @@ ExternalPlugin.SyntaxHighlighting({
|
|
|
36
39
|
|
|
37
40
|
| Option | Type | Default | Description |
|
|
38
41
|
| --------------------- | --------------------------------------- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
39
|
-
| `theme` | `{ light: CodeTheme, dark: CodeTheme }` | `{ light: "github-light", dark: "github-dark" }` | The
|
|
42
|
+
| `theme` | `{ light: CodeTheme, dark: CodeTheme }` | `{ light: "github-light", dark: "github-dark" }` | The Shiki themes to use in light and dark mode. |
|
|
40
43
|
| `keepBackground` | `boolean` | `false` | Whether to keep the background color of the code block. |
|
|
41
44
|
| `clipboard` | `boolean` | `true` | Whether to add a clipboard copy button to code blocks. |
|
|
42
45
|
| `tokenClassification` | `boolean` | `true` | Adds `data-token-type` attributes (keyword, string, comment, etc.) to token spans. Enables theme-aware code styling via CSS selectors. |
|