Footnotes query with Dataview JS

What I’m trying to do

I’m trying to extract footnotes with a specific tag from all my research notes.

Things I have tried

Here is code I’ve tried. My main issue is that when I split by new lines, the footnotes get removed, but when I look at the .md file they appear on their own line.

```dataviewjs
let tag = "#status/TODO";
let pages = dv.pages('"some/path/here"'); 
for (let p of pages){
    let content = await dv.io.load(p.file.path);
    let lines = content.split('\n').filter(line => new RegExp(tag).test(line));
    dv.el("article",lines);
} 

Nevermind, I’ve solved my problem here. The footnotes weren’t getting removed, they just weren’t appearing in the output because they contain the carat symbol.

let tags = ["a","b"];
let pages = dv.pages('"some/path/here"'); 
for (let p of pages){
    let content = await dv.io.load(p.file.path);
    let lines = content.split('\n').filter(line => {
        return tags.every(tag => new RegExp(tag).test(line));
    });
    lines = lines.map(line => line.replace(/\^/g, ''));
    dv.el("article", lines);
} 
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.