0.1.3 • Published 5 months ago
@platecms/delta-cast-util-to-slate v0.1.3
cast-util-to-slate
This library is part of the CAST abstract syntax tree utilities. It provides a utility to convert a CAST abstract syntax tree to a Slate editor document
Usage
Using the utility slate to cast looks as follows:
import {toSlate} from '@platecms/delta-cast-util-to-slate'
const tree ={
type: 'root',
children: [
{
type: 'paragraph',
children: [
{ type: 'text', value: 'Hello, world!' }
]
}
]
}
console.info(toSlate(tree))yields:
[
{
"type": "paragraph",
"children": [
{ "text": "Hello, world!" }
]
}
]Building
Run nx build cast-util-to-slate to build the library.
Running unit tests
Run nx test cast-util-to-slate to execute the unit tests via Vitest.