farling42 / obsidian-import-json

Plug-in for Obsidian.md which will create Notes from JSON files
MIT License
85 stars 5 forks source link

Prop contains html and template doesnt escape #60

Closed hakdag closed 6 months ago

hakdag commented 8 months ago

I have a sample JSON similar to this:

{ "id": "1", "name": "test", "fields": { "description": "<p>description</p>" } }

And template:

{{name}} ({{id}})

Fields

| {{#each fields}} {{@key}} | {{/each}} | {{#each fields}} - | {{/each}} | {{#each fields}} {{this}} | {{/each}}

in the template, last line produces description in a table. {{this}} is not escaped. Result is:

description

What should I do?

farling42 commented 8 months ago

You could try {{{this}}} using three brackets instead of only 2. I'm not sure what you're expecting in your result, since you only show the value of the "description" field.