Socket
Socket
Sign inDemoInstall

@sanity/block-content-to-html

Package Overview
Dependencies
2
Maintainers
7
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.3 to 0.1.4

2

package.json
{
"name": "@sanity/block-content-to-html",
"description": "Customizable HTML parser for block editor output",
"version": "0.1.3",
"version": "0.1.4",
"main": "lib/index.js",

@@ -6,0 +6,0 @@ "umd": "umd/index.min.js",

@@ -197,4 +197,4 @@ # block-content-to-html-js

marks: {
em: null // Just igonore 'em' tags.
code: 'pre' // Render 'code' marks to 'pre' tags
em: null // Just igonore 'em' marks.
code: 'pre' // Render 'code' marks as 'pre' tags
}

@@ -206,5 +206,7 @@ ```

``block-content-to-html`` supports setting custom data on the original block content
through the ``.extra`` property on a block. This is handy if you for example want
to generate and keep track of a HTML id attribute.
through setting a ``.extra`` property on a block element. This is handy if you want
to generate and keep track of a HTML id attribute, or other arbitrary data related to rendering.
The value can be anything you like.
Example:

@@ -216,3 +218,3 @@

"style": "h2",
"extra": "header_1234",
"extra": "header_1234", // Our extra property added to the original content.
"spans": [

@@ -231,3 +233,4 @@ {

h2: node => {
return `<div class="big-heading" id="${node.extra}">${node.children}</div>`
const htmlId = node.extra // Here it is available for us
return `<h2 id="${htmlId}">${node.children}</h2>`
}

@@ -245,3 +248,3 @@ }

```html
<div class="big-heading" id="header_1234">Such h2 header, much amaze</div>
<h2 id="header_1234">Such h2 header, much amaze</h2>
```

@@ -248,0 +251,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc