From e9fb0ecb96a2de53cf5f060c4e151f539ca4b089 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Fri, 02 Feb 2024 05:19:51 +0000
Subject: [PATCH] fix: border radius on search preview
---
quartz/plugins/transformers/ofm.ts | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts
index 8c405bf..44df3fa 100644
--- a/quartz/plugins/transformers/ofm.ts
+++ b/quartz/plugins/transformers/ofm.ts
@@ -290,8 +290,9 @@
}
tag = slugTag(tag)
- if (file.data.frontmatter?.tags?.includes(tag)) {
- file.data.frontmatter.tags.push(tag)
+ if (file.data.frontmatter) {
+ const noteTags = file.data.frontmatter.tags ?? []
+ file.data.frontmatter.tags = [...new Set([...noteTags, tag])]
}
return {
@@ -382,14 +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:
- restOfTitle.length === 0
- ? [{ type: "text", value: titleContent + " " }]
- : restOfTitle,
+ children: [
+ {
+ type: "text",
+ value: useDefaultTitle ? capitalize(calloutType) : titleContent + " ",
+ },
+ ...restOfTitle,
+ ],
}
const title = mdastToHtml(titleNode)
--
Gitblit v1.10.0