From cec4877adb7e89f4d4e0a442e82655e0d35dbe16 Mon Sep 17 00:00:00 2001
From: Ben Schlegel <31989404+benschlegel@users.noreply.github.com>
Date: Thu, 05 Oct 2023 16:19:56 +0000
Subject: [PATCH] fix(breadcrumbs): problem with folder whitespace (#522)
---
quartz/plugins/transformers/ofm.ts | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts
index 8306f40..226e939 100644
--- a/quartz/plugins/transformers/ofm.ts
+++ b/quartz/plugins/transformers/ofm.ts
@@ -14,6 +14,7 @@
import { toHast } from "mdast-util-to-hast"
import { toHtml } from "hast-util-to-html"
import { PhrasingContent } from "mdast-util-find-and-replace/lib"
+import { capitalize } from "../../util/lang"
export interface Options {
comments: boolean
@@ -104,10 +105,6 @@
return calloutMapping[callout] ?? "note"
}
-const capitalize = (s: string): string => {
- return s.substring(0, 1).toUpperCase() + s.substring(1)
-}
-
// !? -> optional embedding
// \[\[ -> open brace
// ([^\[\]\|\#]+) -> one or more non-special characters ([,],|, or #) (name)
@@ -400,6 +397,10 @@
return (tree: Root, file) => {
const base = pathToRoot(file.data.slug!)
findAndReplace(tree, tagRegex, (_value: string, tag: string) => {
+ // Check if the tag only includes numbers
+ if (/^\d+$/.test(tag)) {
+ return false
+ }
tag = slugTag(tag)
if (file.data.frontmatter && !file.data.frontmatter.tags.includes(tag)) {
file.data.frontmatter.tags.push(tag)
--
Gitblit v1.10.0