Adam Brangenberg
2023-07-31 cbae88fc4e9b98764cfccca2e85f265c4b894573
quartz/plugins/transformers/syntax.ts
@@ -3,23 +3,14 @@
export const SyntaxHighlighting: QuartzTransformerPlugin = () => ({
  name: "SyntaxHighlighting",
  markdownPlugins() {
    return []
  },
  htmlPlugins() {
    return [[rehypePrettyCode, {
      theme: 'css-variables',
      onVisitLine(node) {
        if (node.children.length === 0) {
          node.children = [{ type: 'text', value: ' ' }]
        }
      },
      onVisitHighlightedLine(node) {
        node.properties.className.push('highlighted')
      },
      onVisitHighlightedWord(node) {
        node.properties.className = ['word']
      },
    } satisfies Partial<CodeOptions>]]
  }
    return [
      [
        rehypePrettyCode,
        {
          theme: "css-variables",
        } satisfies Partial<CodeOptions>,
      ],
    ]
  },
})