fix: tag regex no longer includes purely numerical 'tags' (#485)
* fix: tag regex no longer includes purely numerical 'tags' * fix: formatting * fix: use guard in findAndReplace() instead of expanding the regex
This commit is contained in:
parent
1bf7e3d8b3
commit
27a6087dd5
@ -400,6 +400,10 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>
|
|||||||
return (tree: Root, file) => {
|
return (tree: Root, file) => {
|
||||||
const base = pathToRoot(file.data.slug!)
|
const base = pathToRoot(file.data.slug!)
|
||||||
findAndReplace(tree, tagRegex, (_value: string, tag: string) => {
|
findAndReplace(tree, tagRegex, (_value: string, tag: string) => {
|
||||||
|
// Check if the tag only includes numbers
|
||||||
|
if (/^\d+$/.test(tag)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
tag = slugTag(tag)
|
tag = slugTag(tag)
|
||||||
if (file.data.frontmatter && !file.data.frontmatter.tags.includes(tag)) {
|
if (file.data.frontmatter && !file.data.frontmatter.tags.includes(tag)) {
|
||||||
file.data.frontmatter.tags.push(tag)
|
file.data.frontmatter.tags.push(tag)
|
||||||
|
Loading…
Reference in New Issue
Block a user