Closed flayks closed 3 years ago
I dont think this will fix your issue, but you want to be passing the 'content' array to blocksToHtml.blocks
and use Svelte's {@html }
expression like so...
<script>
import blocksToHtml from '@sanity/block-content-to-html'
</script>
<div class="text">
{@html blocksToHtml({ blocks: content })}
</div>
I dont think this will fix your issue, but you want to be passing the 'content' array to
blocksToHtml.blocks
and use Svelte's{@html }
expression like so...<script> import blocksToHtml from '@sanity/block-content-to-html' </script> <div class="text"> {@html blocksToHtml({ blocks: content })} </div>
Indeed, I'm not really sure that will fix anything for now as the problem is more when importing the library. The result content type from Sanity right now is an object if I'm correct so for now it just returns [object Object]
as it is not interpreted yet. But if that were to work, yes I'd have to use {@html}
:)
Fixed with v2.0.0 apparently
I'm trying to use this plugin to convert my HTML blocks from Sanity to my SvelteKit project which is based on Vite and ESM, and since it doesn't support requires, I get this error:
My (super simple) implementation: