omnivore-app / obsidian-omnivore

Obsidian plugin to fetch articles and highlights from Omnivore
MIT License
726 stars 39 forks source link

Content not imported when inside a conditional section #142

Open kavun opened 9 months ago

kavun commented 9 months ago

With a template like this, with content only expected to render if note exists, the content does not get rendered.

{{#note}}
## Notes
{{{note}}}

## Full Article
{{{content}}}
{{/note}}

This is because includeContent is only set to true when content is at the "root" level of the mustache template. https://github.com/omnivore-app/obsidian-omnivore/blob/2304fde1516164fb42d2f2258db2c5510252c023/src/main.ts#L204-L206

In my case, content is under the note span. image

As a workaround, I have added a "root" level comment span with the text content, and this does force includeContent to be true and my content to get imported, but ideally I wouldn't have to hack it like this.

{{! content }}
{{#note}}
## Notes
{{{note}}}

## Full Article
{{{content}}}
{{/note}}
kavun commented 9 months ago

FWIW, the Logseq plugin always fetches content https://github.com/omnivore-app/logseq-omnivore/blob/83484a66ae7cbb9b71e853e9da8c73dbffcf8fb6/src/index.ts#L228