oleeskild / digitalgarden

290 stars 160 forks source link

dataview js not showing any output #179

Open wheresalice opened 1 year ago

wheresalice commented 1 year ago

My dataview JS query isn't rendering on site

The following code produces a count of countries that I have visited when used in Obsidian

- Visited Countries: `$=dv.pages('"travel/countries"').where(p => p['visited']>0).length`

But the published version renders this as <li>Visited Countries: </li>

Do I need to do something differently to make this work?

jonathanhung commented 1 year ago

I also ran into the same issue

jonathanhung commented 1 year ago

Reporting back, it looks like when you use dataview (not dataviewJS) table and list it will render... perhaps has to do with dataviewJS not being rendered into HTML...? Not an expert in dataviewJS, but I'm guessing you'll have to wrap what you get back into HTML/CSS

image

first block is dataviewJS, second and third done with dataview

jonathanhung commented 1 year ago

remains an issue after trying a few different things.

Image 1: shot from my repo after using dataview List image

Image 2: shot from my repo after using dataviewJS list image

image 3: inspecting obsidian shows identical markup except one is wrapped in <div class=block-language-dataviewjs image

Not sure where in the code you detect dataview blocks and render them into markdown but it looks like it needs to also look for class="block-language-dataviewjs"

cc @oleeskild

jonathanhung commented 1 year ago

tried removing hideDataview from index.njk but still isn't rendering.

{{ content | hideDataview | link | taggify | safe}}