From ac93fe31a2e4afdf762073caf6b725bb54f615bc Mon Sep 17 00:00:00 2001 From: Emile Bangma Date: Fri, 7 Jun 2024 10:26:27 +0000 Subject: [PATCH] .callout-content support --- quartz/plugins/transformers/ofm.ts | 16 ++++++++++++++++ quartz/styles/callouts.scss | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts index 414d8f65c..7cd6d8bea 100644 --- a/quartz/plugins/transformers/ofm.ts +++ b/quartz/plugins/transformers/ofm.ts @@ -492,6 +492,22 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin "data-callout-metadata": calloutMetaData, }, } + + // Add callout-content class to callout body if it has one. + if (node.children.length > 1) { + const contentData = node.children[1] + node.children[1] = { + data: { + hProperties: { + ...(contentData.data?.hProperties ?? {}), + className: "callout-content", + }, + hName: "div", + }, + type: "blockquote", + children: [contentData], + } + } } }) } diff --git a/quartz/styles/callouts.scss b/quartz/styles/callouts.scss index b1fd180ce..d6f65aadc 100644 --- a/quartz/styles/callouts.scss +++ b/quartz/styles/callouts.scss @@ -10,7 +10,7 @@ transition: max-height 0.3s ease; box-sizing: border-box; - & > *:nth-child(2) { + & > .callout-content > :first-child { margin-top: 0; }