Hi, maybe it’s too late, but let me share my idea here for those who arrive on this page.
Dataview provides an API for plugin developers.
Its syntax is almost the same as DataviewJS.
For example, you can write something like this to display all the backlinks for path
.
const dv = getAPI(this.app);
if (dv) {
let page = dv.page(path); // Dataview page object
if (page) {
for (let backlink of page.file.inlinks) {
console.log(backlink.path);
}
}
}
Alternatively:
getAPI(this.app)?.index.links.invMap.get(path)
EDIT: There seems to be another plugin that offers an API for getting backlinks for ALL the TFile
s in the vault, while the Dataview API only provides backlinks for markdown files.