Skip to content

Instantly share code, notes, and snippets.

@eleanorkonik
Created May 24, 2022 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eleanorkonik/a89bf1c133b43cf671c3495dc3ad3b9d to your computer and use it in GitHub Desktop.
Save eleanorkonik/a89bf1c133b43cf671c3495dc3ad3b9d to your computer and use it in GitHub Desktop.
Find non-existent notes with multiple files linking to them... and readwise imports with lots of useful annotations
```dataview
TABLE file.inlinks AS Inlinks, file.outlinks AS Outlinks, file.tags AS Tags
FROM "10 Pending"
WHERE length(file.inlinks) > 0 OR length(file.outlinks) > 1 Or length(file.tags) > 2
SORT file.size ASC
```
```dataviewjs
const count = 2;
let d = {};
function process(k, v) {
Object.keys(v).forEach(function (x) {
x = dv.fileLink(x);
if (d[x]==undefined) { d[x] = []; }
d[x].push(dv.fileLink(k));
});
}
Object.entries(dv.app.metadataCache.unresolvedLinks)
.filter(([k,v])=>Object.keys(v).length)
.forEach(([k,v]) => process(k, v));
dv.table(["Non existing notes", "Linked from"],
Object.entries(d)
.filter(([k, v]) => v.length >= count)
.sort((a, b) => b[1].length - a[1].length)
.map(([k,v])=> [k, v.join(" • ")]))
```
@Balmasexy
Copy link

Assigned to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment