Dataview only markup files visible

Happy Thursday,
I am trying to get a dashboard working showing all pdf added to my vault.
I am seeing only .md files but no .pdf or .png. Is it possible to display all file types.
thanks
Alex

let all_files = await app.vault.getFiles() // all files
let canvas_files = all_files.filter(x => x.extension == "canvas") // only canvas files
console.log(canvas_files)

Here’s a piece of code I use to grab canvas files. With a bit more manipulating I can tabulate the results, though the metadata options are more limited than on .md files.
With the right mapping, flattening, filtering, and sorting you can do by hand most of what you can in dv.

In any case, I expect this can be adapted for your purposes.

Thanks mate, unfortunately I am not so familiar with coding and where to add those code snippets. But it looks like this requires some effort. I guess my idea of listing all file types has to wait.

oh sorry, this would be in a dataviewjs block.
If you’re comfortable using regular dataview queries I do recommend dipping your toe into dataviewjs. The forum has a lot of example code that you can look at to piece things together, but it did take me a while at first.

This is a tweak of the previous code to print a list of the filenames of pdfs.

```dataviewjs
let all_files = await app.vault.getFiles() // all files
let pdfs = all_files.filter(x => x.extension == "pdf") // only pdf files
dv.paragraph(pdfs.map(x => x.name)) // print list of file names

```

EDIT:
here’s a version that list the pdfs with working links:

```dataviewjs
let all_files = await app.vault.getFiles() // all files
let pdfs = all_files.filter(x => x.extension == "pdf") // only pdf files
let pdf_list = []
pdfs.map(x => pdf_list.push(dv.fileLink(x.path)) ) 
dv.paragraph(pdf_list)
```
1 Like

Good evening Mate, thanks it is working nicely. I will certainly look into little tweaks, like sorting by date added, and add also newly added image file.

1 Like