From 929e5c99a3e895c282bf8fe49e9296e59b04e960 Mon Sep 17 00:00:00 2001 From: Ross Keenan Date: Fri, 3 Dec 2021 21:27:26 +0200 Subject: [PATCH] fix(TagNote): :bug: Check for other formats of tags, too (Fix #193) --- src/main.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main.ts b/src/main.ts index e17abdf9..741d6743 100644 --- a/src/main.ts +++ b/src/main.ts @@ -220,8 +220,8 @@ export default class BCPlugin extends Plugin { } addIcon(DUCK_ICON, DUCK_ICON_SVG); addIcon(TRAIL_ICON, TRAIL_ICON_SVG); - await this.waitForCache(); + await this.waitForCache(); this.mainG = await this.initGraphs(); for (const view of this.VIEWS) { @@ -902,11 +902,14 @@ export default class BCPlugin extends Plugin { const tag = (altFile[BC_TAG_NOTE] as string).trim(); if (!tag.startsWith("#")) return; - const hasThisTag = (file: TFile) => - this.app.metadataCache - .getFileCache(file) - ?.tags?.map((t) => t.tag) - .some((t) => t.includes(tag)); + const hasThisTag = (file: TFile): boolean => { + const cache = this.app.metadataCache.getFileCache(file); + return ( + cache?.tags?.map((t) => t.tag).some((t) => t.includes(tag)) || + cache?.frontmatter?.tags?.includes(tag.slice(1)) || + cache?.frontmatter?.tag?.includes(tag.slice(1)) + ); + }; const targets = frontms .map((ff) => ff.file)