Socket
Socket
Sign inDemoInstall

blocks-html-renderer

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    blocks-html-renderer

Render the content of Strapi's Blocks rich text editor as HTML in your frontend.


Version published
Weekly downloads
42
decreased by-20.75%
Maintainers
1
Install size
26.1 kB
Created
Weekly downloads
 

Readme

Source

Strapi Blocks React Renderer

Render the content of Strapi's Blocks rich text editor as HTML in your frontend.

Installation

Install the HTML-Blocks renderer and its peer dependencies:

yarn add blocks-html-renderer
npm install blocks-html-renderer

Basic usage

After fetching your Strapi content, you can use the renderBlock function to render the data from a blocks attribute. Pass the array of blocks coming from your Strapi API to the content prop:

import { renderBlock, type Node } from 'blocks-html-renderer';

// Content should come from your Strapi API
const content: Node[] = [
  {
    type: 'paragraph',
    children: [{ type: 'text', text: 'A simple paragraph' }],
  },
];

renderBlock(content);
//<p>A simple paragraph</p>

Keywords

FAQs

Last updated on 29 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc