When executing dataviewJS queries, the main options for rendering encapsulates the query output in another element, and I’m wondering whether there is an option to feed it directly back as markdown and let Obsidian render it, as if it were normal markdown.
Example with header, some text and a codeblock
```dataviewjs
dv.paragraph(`
## A section on javascript
A very basic javascript.
~~~javascript
console.log("Hello world")
~~~
`)
```
## A section on javascript
A very basic javascript.
~~~javascript
console.log("Hello world")
~~~
In the example I duplicate the markdown. One rendered via dataviewjs and one normal, this produces this output:
As can be seen in the reading view in the above image, it doesn’t display “correctly” when encapsulated using dv.paragraph()
, and I haven’t found the correct method to render my markdown for presenting through dataviewjs. I’ve tried some of the variants, but haven’t found the correct way to do this, yet.
In the DOM view on the right, you also see that this version encapsulates the code with <P>
, and that the actual <H2>
header is encapsulated in a <SPAN>
-element, and that it’s missing the collapse ability, and classes and other stuff which would have come from a normal rendering.
So do anyone know How to encapsulate markdown produced within dataviewjs to get a proper rendering of it??
A very similar question is How do you handle the output from dv.markdownQuery()
and family? (Besides actually writing those to a separate file, or something like that)