Skip to content

Commit

Permalink
Handle external links with blank text
Browse files Browse the repository at this point in the history
  • Loading branch information
iafisher committed Jun 10, 2023
1 parent 0c51978 commit 68bbc8e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,17 @@ export default class QuickLinksPlugin extends Plugin {
}

const linkHrefNoPrefix = linkHref.slice(quickLink.prefix.length + 1);
const displayText = linkHref === linkText ? linkHrefNoPrefix : linkText;
const displayText =
// [](w:Whatever) --> linkText === ""
// [[w:Whatever]] --> linkHref === linkText
//
// In either case, we should use "Whatever" as the display text.
//
// Otherwise, the user has set some custom display text and we should
// use that.
linkText === "" || linkHref === linkText
? linkHrefNoPrefix
: linkText;

const linkTarget = quickLink.target.replace("%s", linkHrefNoPrefix);

Expand Down

0 comments on commit 68bbc8e

Please sign in to comment.