From ba9f243728cab171f86b40b9d50db485af272a39 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Sat, 01 Jul 2023 07:03:01 +0000
Subject: [PATCH] tag and folder pages
---
quartz/plugins/transformers/syntax.ts | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/quartz/plugins/transformers/syntax.ts b/quartz/plugins/transformers/syntax.ts
index f09daaa..0f46519 100644
--- a/quartz/plugins/transformers/syntax.ts
+++ b/quartz/plugins/transformers/syntax.ts
@@ -1,15 +1,9 @@
-import { PluggableList } from "unified"
import { QuartzTransformerPlugin } from "../types"
import rehypePrettyCode, { Options as CodeOptions } from "rehype-pretty-code"
-export class SyntaxHighlighting extends QuartzTransformerPlugin {
- name = "SyntaxHighlighting"
-
- markdownPlugins(): PluggableList {
- return []
- }
-
- htmlPlugins(): PluggableList {
+export const SyntaxHighlighting: QuartzTransformerPlugin = () => ({
+ name: "SyntaxHighlighting",
+ htmlPlugins() {
return [[rehypePrettyCode, {
theme: 'css-variables',
onVisitLine(node) {
@@ -18,11 +12,13 @@
}
},
onVisitHighlightedLine(node) {
+ node.properties.className ??= []
node.properties.className.push('highlighted')
},
onVisitHighlightedWord(node) {
- node.properties.className = ['word']
+ node.properties.className ??= []
+ node.properties.className.push('word')
},
} satisfies Partial<CodeOptions>]]
}
-}
+})
--
Gitblit v1.10.0