Skip to content

Commit

Permalink
fix(TagNote): 🐛 Check for other formats of tags, too (Fix #193)
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Dec 3, 2021
1 parent 60df361 commit 929e5c9
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 929e5c9

Please sign in to comment.