Skip to content

Commit

Permalink
fix: normalize aliases when linkifying spells
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed Sep 30, 2023
1 parent f5676c2 commit dd79164
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/util/linkify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ class LinkifierClass extends Component {
context: string
): { alias: string | null; file: TFile | null } {
input = input.trim();
let filePath = this.#cache.get(input) ?? input;
let alias = this.#cache.has(input) ? input : null;
let filePath =
this.#cache.get(input) ??
this.#cache.get(input.toLowerCase()) ??
input;
let alias =
this.#cache.has(input) || this.#cache.has(input.toLowerCase())
? input
: null;
return {
alias,
file: app.metadataCache.getFirstLinkpathDest(filePath, context)
Expand All @@ -49,6 +55,7 @@ class LinkifierClass extends Component {
const aliases = parseFrontMatterAliases(frontmatter) ?? [];
for (const alias of aliases) {
this.#cache.set(alias, file.name);
this.#cache.set(alias.toLowerCase(), file.name);
}
})
);
Expand Down

0 comments on commit dd79164

Please sign in to comment.