Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sanity/block-content-to-tree

Package Overview
Dependencies
Maintainers
7
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/block-content-to-tree - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

2

package.json
{
"name": "@sanity/block-content-to-tree",
"description": "Converts the flat Sanity block content structure into a generic tree structure for easier transformation into other formats.",
"version": "0.0.2",
"version": "0.0.3",
"main": "lib/index.js",

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

@@ -9,5 +9,5 @@ # block-content-to-tree-js

## Usage
## Quick example
```
```js

@@ -49,3 +49,3 @@ // The flat block content structure

```
```js
{

@@ -69,6 +69,65 @@ type: 'block',

For more examples, see the tests.
## Entities
### Block (text)
```js
{
type: 'block',
style: 'normal' // Text style
mark: 'em', // Mark indicating all content is wrapped in bold.
content: [
'Hello world! ', // Span with no marks or attributes (plain text).
{
type: 'span',
// Data attributes for this span
attributes: {link: {href: 'http://...'}},
mark: 'strong',
// The text content for the span
// Always an array with a single plain text.
// An array to keep format consistent with block.content.
content: [
'I am a link!'
]
}
]
}
```
### List
Root element
```js
{
type: 'list',
itemStyle: 'bullet' // The list style
// Items are blocks (see above)
items: [
{block},
{block}
]
}
```
### Custom blocks
```js
{
type: 'author' // Whatever, but never 'block' (built in type)
attributes: { // Custom attributes for the type
name: 'John Ronald Reuel Tolkien',
}
}
```
## More information / examples
Please see the tests.
## License
MIT-licensed
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc