Created
February 17, 2022 15:46
-
-
Save eleanorkonik/c650c193751436463f427690f680546e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```dataviewjs | |
//get all md files in vault | |
const files = app.vault.getMarkdownFiles() | |
//create an array with the filename and lines that include the desired tag | |
let arr = files.map(async(file) => { | |
const content = await app.vault.cachedRead(file) | |
//turn all the content into an array | |
let lines = await content.split("\n").filter(line => line.includes("- [?]")) | |
return ["[["+file.name.split(".")[0]+"]]", lines] | |
}) | |
//resolve the promises and build the table | |
Promise.all(arr).then(values => { | |
console.log(values) | |
//filter out files without "ad-question" and the note with the dataview script | |
const exists = values.filter(value => value[1][0] && value[0] != "[[dataviewjs-testing]]") | |
dv.table(["file", "lines"], exists) | |
}) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1st of all thanks for this
I've being searching for this a long time, and it lead me to this:
This can make the same as yours (Showing only the ?, i, *....) but easily you can filter by file, which I prefer, because I use this in a specific section of my vault and I dont want it to show every "alternative task" in the vault, but an specific #.
It would be like this:
And if you want a list of all alternative tasks together
And I love this because I don't know js, and this just uses the dataview syntax which is really easy to remember..
This could be old news for you, but for me is a long time goal achieved.
Thanks again, without yours I wouldn't had ever start looking for this one