From f31cabbbf9b0d438710618a3edd2a4eaaae09d7d Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Mon, 15 Jan 2024 12:37:50 -0800
Subject: [PATCH] fix: dont use default callout title if theres additional
 title children left (closes #693)

---
 quartz/plugins/transformers/ofm.ts | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts
index 35257cc..6688059 100644
--- a/quartz/plugins/transformers/ofm.ts
+++ b/quartz/plugins/transformers/ofm.ts
@@ -366,7 +366,7 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>
               }
 
               const text = firstChild.children[0].value
-              const restChildren = firstChild.children.slice(1)
+              const restOfTitle = firstChild.children.slice(1)
               const [firstLine, ...remainingLines] = text.split("\n")
               const remainingText = remainingLines.join("\n")
 
@@ -382,7 +382,10 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>
                   match.input.slice(calloutDirective.length).trim() || capitalize(calloutType)
                 const titleNode: Paragraph = {
                   type: "paragraph",
-                  children: [{ type: "text", value: titleContent + " " }, ...restChildren],
+                  children:
+                    restOfTitle.length === 0
+                      ? [{ type: "text", value: titleContent + " " }]
+                      : restOfTitle,
                 }
                 const title = mdastToHtml(titleNode)