0.1.3 • Published 5 months ago

@platecms/delta-cast-util-from-slate v0.1.3

Weekly downloads
-
License
UNLICENSED
Repository
bitbucket
Last release
5 months ago

cast-util-from-slate

This library is part of the CAST abstract syntax tree utilities. It provides a utility to convert a Slate editor document to a CAST abstract syntax tree.

Usage

Using the utility cast from slate looks as follows:

import {fromSlate} from '@platecms/delta-cast-util-from-slate'

const slate = [
    {
        type: 'paragraph',
        children: [
            { text: 'Hello, world!' }
        ]
    }
]

console.info(fromSlate(slate))

yields:

{
    "type": "root",
    "children": [
        {
            "type": "paragraph",
            "children": [
                {
                    "type": "text",
                    "value": "Hello, world!"
                }
            ]
        }
    ]
}

Building

Run nx build cast-util-from-slate to build the library.

Running unit tests

Run nx test cast-util-from-slate to execute the unit tests via Vitest.