@quartz-community/syntax-highlighting 1.0.3 → 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 CHANGED
@@ -1,3 +1,9 @@
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
+
1
7
  ## 1.0.3
2
8
 
3
9
  ### 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 github:quartz-community/syntax-highlighting
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: github:quartz-community/syntax-highlighting
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 theme to use for syntax highlighting. |
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. |
package/dist/index.js CHANGED
@@ -27602,7 +27602,11 @@ var SyntaxHighlighting = (userOpts) => {
27602
27602
  contentType: "inline"
27603
27603
  });
27604
27604
  css.push({
27605
- content: clipboard_default,
27605
+ // In Quartz's base layer, so themes (e.g. @quartz-themes/core's `obsidian` layer)
27606
+ // can restyle the button.
27607
+ content: `@layer quartz-base {
27608
+ ${clipboard_default}
27609
+ }`,
27606
27610
  inline: true
27607
27611
  });
27608
27612
  }