1.7.0 • Published 6 months ago

@voiceflow/slate-serializer v1.7.0

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

Slate Serializer

Utilities for converting slate data into raw text or JSX.

Installation

yarn add @voiceflow/slate-serializer @voiceflow/base-types slate
# or
npm install @voiceflow/slate-serializer @voiceflow/base-types slate

If you want to use the JSX serializer make sure to install react.

yarn add react
# or
npm install react

Usage

You can access type guards and other extraction utilities through the main import.

import { isLinkElement, getTextCSSProperties } from '@voiceflow/react-chat';

Text Serialization

If you need the textual representation you can import the text serializer.

import { serializeToText } from '@voiceflow/react-chat/text';

const text = serializeToText(slateValue);

You can turn off encodeVariables to avoid encoding variables in the text.

import { serializeToText } from '@voiceflow/react-chat/text';

const textWithoutVariables = serializeToText(slateValue, { encodeVariables: false });

JSX Serialization

If you want to render the result in a browser you can serialize to JSX.

import { serializeToJSX } from '@voiceflow/react-chat/jsx';

const content = <div>{serializeToJSX(slateValue)}</div>;

Markdown Serialization

If you want to render the result in a browser you can serialize to JSX.

import { serializeToMarkdown } from '@voiceflow/react-chat/markdown';

const content = <div>{serializeToMarkdown(slateValue)}</div>;
1.7.0

6 months ago

1.6.0

1 year ago

1.5.5

2 years ago

1.5.4

2 years ago

1.5.3

2 years ago

1.5.2

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.2.3

3 years ago

1.3.0

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago