Skip to content

Commit

Permalink
Fix: properly escaping pipes in Link.obsidianLink()
Browse files Browse the repository at this point in the history
Closes #2264
  • Loading branch information
GottZ authored Mar 13, 2024
1 parent e4a6cab commit b77bf79
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/data-model/value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,9 @@ export class Link {

/** Convert the inner part of the link to something that Obsidian can open / understand. */
public obsidianLink(): string {
const escaped = this.path.replace("|", "\\|");
if (this.type == "header") return escaped + "#" + this.subpath?.replace("|", "\\|");
if (this.type == "block") return escaped + "#^" + this.subpath?.replace("|", "\\|");
const escaped = this.path.replaceAll("|", "\\|");
if (this.type == "header") return escaped + "#" + this.subpath?.replaceAll("|", "\\|");
if (this.type == "block") return escaped + "#^" + this.subpath?.replaceAll("|", "\\|");
else return escaped;
}

Expand Down

0 comments on commit b77bf79

Please sign in to comment.