Nested list in dataview

What I’m trying to do

I want to write a summary in the metadata field. This summary can contain a nested list that I want to show and access in dataview. For example


summary: This is a summary. In this summary there is a nested list (-) example 1 (–) (-) example 2. (–) then there is some more text.

Now I want to access it via dataview and have a list (not a table) that looks like this

-This is a summary. In this summary there is a nested list
- example 1
- example 2.
then there is some more text.

(-) marks the beginning of a nested bullet point, (–) the end.

Things I have tried

Having a separate field in the metadata for the bullet points, for example


summary: This is a summary. In this summary there is a nested list
properties:

  • example 1
  • example 2.

but in this example I don’t know how to combine summary and properties to get a nested list. Also this is not a perfect solution if a have text after the bullet list.

I also played around with regex to extract the (bullet points) but I don’t know how to then display this as nested lists.

I don’t think that’s doable at all. At least I’ve never seen an inline field with lists within. I’ve seen inline fields with multiple lines (as in an array), but it’s still not quite the same.

The closest variant I can think of, besides switching to either using list or task with sub items (which would require some different markup), or using section embedding (which would list all text under a given heading, using some javascript), would be to do something like the following example:

summary:: Some text, followed by a a list
summary:: - First list item
summary:: - Second list item
summary:: And even more text?!

```dataview
LIST summary
WHERE file.path = this.file.path
```

```dataview
TABLE summary
WHERE file.path = this.file.path
```

Which produces something like the following:

Alternatively: Use HTML

Right before I posted this, I remembered that you could possibly do this using HTML, so then I whipped up this example:

summary2:: This is just a test<br /><ul><li>first<li>second</ul>And some more

```dataview
LIST summary2
WHERE file.path = this.file.path
```

Which outputs as:
image

But it does have it drawbacks related to you having to write HTML, and you can’t use ordinary markup in between the HTML markup… I tend to avoid HTML in my markdown as much as possible, which is also why I didn’t think of that at first.

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