Jacky Zhao
2023-06-17 6d5491fdcbccfad7af6c6dcc63ce2f67abd3850c
quartz/plugins/transformers/ofm.ts
@@ -6,6 +6,7 @@
import rehypeRaw from "rehype-raw"
import { visit } from "unist-util-visit"
import path from "path"
import { JSResource } from "../../resources"
export interface Options {
  highlight: boolean
@@ -235,6 +236,7 @@
                node.children.splice(0, 1, ...blockquoteContent)
                // add properties to base blockquote
                // TODO: add the js to actually support collapsing callout
                node.data = {
                  hProperties: {
                    ...(node.data?.hProperties ?? {}),
@@ -270,16 +272,19 @@
    htmlPlugins() {
      return [rehypeRaw]
    },
    externalResources: {
      js: [{
    externalResources() {
      const mermaidScript: JSResource = {
        script: `
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs';
mermaid.initialize({ startOnLoad: true });
        `,
          import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs';
          mermaid.initialize({ startOnLoad: true });
          `,
        loadTime: 'afterDOMReady',
        moduleType: 'module',
        contentType: 'inline'
      }]
      }
      return {
        js: opts.mermaid ? [mermaidScript] : []
      }
    }
  }
}