ReferenceCache.displayText is empty for markdown link

Steps to reproduce

This is just an issue with the api and nothing I encounter in Obsidian itself.

Create a markdown link like the following in in the root of your vault.


Run app.metadataCache.getCache("").links.first() in the console. Notice that the link exists in metadata cache, but the displayText is empty.

Expected result

ReferenceCache.displayText is set for markdown links.

Actual result

ReferenceCache.displayText is empty for markdown links.


Obsidian version: v1.2.2
Installer version: v1.1.16
Operating system: #1 SMP PREEMPT_DYNAMIC Thu Apr 6 19:47:04 UTC 2023 6.1.23-1-MANJARO
Login status: logged in
Catalyst license: supporter
Insider build toggle: on
Live preview: off
Legacy editor: off
Base theme: dark
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 11
Plugins enabled: 8
1: Find orphaned files and broken links v1.8.0
2: Sort & Permute lines v0.7.0
3: Hotkeys for specific files v1.3.0
4: Advanced URI v1.35.0
5: Version History Diff v2.1.0
6: Cycle through Panes v1.1.1
7: Advanced Tables v0.18.1
8: Hotkeys for Bookmarks v1.0.0

Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.

Additional information

I need this for my plugin Sort and permute lines. I didn’t notice this myself, but someone already proposed a fix here. It’s not very hard to solve this on my side, but I think it would be great if the link cache works for both wiki and markdown link.