From 47024022e834e1bb6c70f671cb32597f42aabd94 Mon Sep 17 00:00:00 2001
From: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 15 Mar 2024 22:29:14 +0000
Subject: [PATCH] chore(deps-dev): bump @types/node from 20.11.24 to 20.11.25 (#990)
---
quartz/plugins/transformers/ofm.ts | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts
index 48428af..4091960 100644
--- a/quartz/plugins/transformers/ofm.ts
+++ b/quartz/plugins/transformers/ofm.ts
@@ -103,9 +103,9 @@
// \[\[ -> open brace
// ([^\[\]\|\#]+) -> one or more non-special characters ([,],|, or #) (name)
// (#[^\[\]\|\#]+)? -> # then one or more non-special characters (heading link)
-// (\|[^\[\]\#]+)? -> | then one or more non-special characters (alias)
+// (\|[^\[\]\#]+)? -> \| then one or more non-special characters (alias)
export const wikilinkRegex = new RegExp(
- /!?\[\[([^\[\]\|\#]+)?(#+[^\[\]\|\#]+)?(\|[^\[\]\#]+)?\]\]/,
+ /!?\[\[([^\[\]\|\#\\]+)?(#+[^\[\]\|\#\\]+)?(\\?\|[^\[\]\#]+)?\]\]/,
"g",
)
const highlightRegex = new RegExp(/==([^=]+)==/, "g")
@@ -176,13 +176,18 @@
const anchor = rawHeader?.trim().replace(/^#+/, "")
const blockRef = Boolean(anchor?.startsWith("^")) ? "^" : ""
const displayAnchor = anchor ? `#${blockRef}${slugAnchor(anchor)}` : ""
- const displayAlias = rawAlias ?? rawHeader?.replace("#", "|") ?? ""
+ let displayAlias = rawAlias ?? rawHeader?.replace("#", "|") ?? ""
const embedDisplay = value.startsWith("!") ? "!" : ""
if (rawFp?.match(externalLinkRegex)) {
return `${embedDisplay}[${displayAlias.replace(/^\|/, "")}](${rawFp})`
}
+ //transform `[[note#^block_ref|^block_ref]]` to `[[note#^block_ref\|^block_ref]]`, display correctly in table.
+ if (displayAlias && displayAlias.startsWith("|")) {
+ displayAlias = `\\${displayAlias}`
+ }
+
return `${embedDisplay}[[${fp}${displayAnchor}${displayAlias}]]`
})
}
@@ -328,7 +333,7 @@
children: [
{
type: "text",
- value: `#${tag}`,
+ value: tag,
},
],
}
--
Gitblit v1.10.0