SNW doesn't work woth dataview index #113
Unanswered
Galaad1899
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
As you can see from the screen, NSW does not work with my dataview indexes.

SNW refers me to a random note, and it doubles the references.
This only happens in the summaries. I don't get it.
I'll copy you my dataviewjs code:
dataviewjs
let note = dv.current().file;
let headings = this.app.metadataCache.getCache(note.path).headings;
let output = headings
.map((header) => {
let indent = " ".repeat(header.level - 1);
let cleanOutlink = (heading) => {
if (heading.indexOf("|") !== -1)
return heading.replace(/[[(.?)|(.?)]]/g, "$1 $2|$2");
if (heading.indexOf("[") !== -1)
return heading.replace(/[[(.*?)]]/g, "$1");
return heading;
};
return
${indent}- [[#${cleanOutlink(header.heading)}]]
;})
.join("\n");
dv.span(output);
Beta Was this translation helpful? Give feedback.
All reactions