From 6d5491fdcbccfad7af6c6dcc63ce2f67abd3850c Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Sat, 17 Jun 2023 19:07:40 +0000
Subject: [PATCH] collapsible toc
---
quartz/plugins/transformers/ofm.ts | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts
index 1b4e07a..aa83953 100644
--- a/quartz/plugins/transformers/ofm.ts
+++ b/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] : []
+ }
}
}
}
--
Gitblit v1.10.0