From 9b8e0c9d1aa5857db3d27bfae229c03b2c8a8b59 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Fri, 02 Feb 2024 07:55:11 +0000
Subject: [PATCH] chore(cleanup): misc refactoring for cleanup, fix some search bugs
---
quartz/plugins/transformers/ofm.ts | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts
index 7cd9499..44df3fa 100644
--- a/quartz/plugins/transformers/ofm.ts
+++ b/quartz/plugins/transformers/ofm.ts
@@ -383,11 +383,17 @@
const calloutType = canonicalizeCallout(typeString.toLowerCase())
const collapse = collapseChar === "+" || collapseChar === "-"
const defaultState = collapseChar === "-" ? "collapsed" : "expanded"
- const titleContent =
- match.input.slice(calloutDirective.length).trim() || capitalize(calloutType)
+ const titleContent = match.input.slice(calloutDirective.length).trim()
+ const useDefaultTitle = titleContent === "" && restOfTitle.length === 0
const titleNode: Paragraph = {
type: "paragraph",
- children: [{ type: "text", value: titleContent + " " }, ...restOfTitle],
+ children: [
+ {
+ type: "text",
+ value: useDefaultTitle ? capitalize(calloutType) : titleContent + " ",
+ },
+ ...restOfTitle,
+ ],
}
const title = mdastToHtml(titleNode)
--
Gitblit v1.10.0