How to achieve a hierarchical Dataview list without bullets but maintaining indentation

I finally figured out how to make a “Directory List” from a dataview list query.

My vault is organized with folders for each course (“Course Name”) and then within those folders are “Week/Module 1”, “Week/Module2”, etc.

-| CS-381
----| Week 1
--------| Note 1
--------| Note 2
----| Week 2

So what I’ve achieved is a directory view like this in the folder note of each course (where - is just space):

Week 1
----- Note 1
----- Note 2
Week 2
----- Note 1
----- Note 2

What results is a formatted, non-bulleted list of notes within the subfolders of each class.

The first thing you need to do is create a file named dataview-list.css with the following lines and save it inside the .obsidian/snippets folder (don’t forget to check the box in the settings to enable the snippet):

/* remove bullet for the "main points (file name) and shift
   the list to the left a bit (since there's no more bullet */
ul.dataview.list-view-ul {
	list-style: none;

Next, within the folder note (or any file inside a base folder) insert this dataview query:

LIST "<br><span style='padding-left: 50px'>" + join(, "</span><br><span style='padding-left: 50px'>") + "<br>"
WHERE contains(file.folder, this.file.folder) & type != "FolderNoteClass"
SORT file.ctime ASC
GROUP BY regexreplace(file.folder, ".*\/([^\/]+)$", "**$1**") AS Folder

We are basically adding inline styling and <span> tags to each of the and inserting <br> tags after each one. For some reason without those, each note link appears on the same line and is comma separated. We also bold face the Folders.

I am sure there is a more elegant way to do this but after a day fiddling with it and finding nothing out there to help with my exact use-case, I thought I would share. Hope this helps someone!

1 Like