A Svelte implementation of Strapi's blocks-react-renderer, adapted for Svelte 5. This library allows you to render Strapi's new Blocks rich text editor seamlessly within your Svelte applications.
You can install this package via npm:
npm install blocks-svelte-renderer
Here's a basic example of how to use the Svelte Blocks Renderer in your Svelte application:
<script>
import BlockRenderer from 'blocks-svelte-renderer';
const contentBlocks = [
{ type: 'heading', level: 2, children: [{ text: 'Hello World' }] },
{ type: 'paragraph', children: [{ text: 'This is a paragraph.' }] },
// Add more content blocks as needed
];
</script>
<BlockRenderer content={contentBlocks} />The following default components are included:
HeadingParagraphImageLinkListListItemQuoteCode
You can customize these components according to your application's requirements.
This project is licensed under the MIT Expat License. Portions of the code are derived from Strapi's blocks-react-renderer, which is also licensed under the MIT Expat License.
- Strapi for their original blocks-react-renderer, which inspired this implementation.