Jacky Zhao
2023-08-17 0998bc355e6425e6b2bdf3d2da7124aa7b63b2a2
quartz/plugins/transformers/syntax.ts
@@ -4,21 +4,13 @@
export const SyntaxHighlighting: QuartzTransformerPlugin = () => ({
  name: "SyntaxHighlighting",
  htmlPlugins() {
    return [[rehypePrettyCode, {
      theme: 'css-variables',
      onVisitLine(node) {
        if (node.children.length === 0) {
          node.children = [{ type: 'text', value: ' ' }]
        }
      },
      onVisitHighlightedLine(node) {
        node.properties.className ??= []
        node.properties.className.push('highlighted')
      },
      onVisitHighlightedWord(node) {
        node.properties.className ??= []
        node.properties.className.push('word')
      },
    } satisfies Partial<CodeOptions>]]
  }
    return [
      [
        rehypePrettyCode,
        {
          theme: "css-variables",
        } satisfies Partial<CodeOptions>,
      ],
    ]
  },
})