Skip to content

Commit

Permalink
fix(TagNote): 🐛 Trim tag in fewer cases
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Jan 7, 2022
1 parent 342d747 commit d20819e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -51829,7 +51829,7 @@ class BCPlugin extends require$$0.Plugin {
var _a, _b, _c;
const { tags, frontmatter } = this.app.metadataCache.getFileCache(file);
return [
...((_a = tags === null || tags === void 0 ? void 0 : tags.map((t) => t.tag.slice(1))) !== null && _a !== void 0 ? _a : []),
...((_a = tags === null || tags === void 0 ? void 0 : tags.map((t) => (t.tag.startsWith("#") ? t.tag.slice(1) : t.tag))) !== null && _a !== void 0 ? _a : []),
...[...((_b = frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.tags) !== null && _b !== void 0 ? _b : [])].flat(),
...[...((_c = frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.tag) !== null && _c !== void 0 ? _c : [])].flat(),
].map((t) => (!t.startsWith("#") && withHash ? "#" : "") + t.toLowerCase());
Expand Down
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,8 @@ export default class BCPlugin extends Plugin {
getAllTags = (file: TFile, withHash = true): string[] => {
const { tags, frontmatter } = this.app.metadataCache.getFileCache(file);
return [
...(tags?.map((t) => t.tag.slice(1)) ?? []),
...(tags?.map((t) => (t.tag.startsWith("#") ? t.tag.slice(1) : t.tag)) ??
[]),
...[...(frontmatter?.tags ?? [])].flat(),
...[...(frontmatter?.tag ?? [])].flat(),
].map(
Expand Down

0 comments on commit d20819e

Please sign in to comment.