open-index/open-npm huggingface dataset:
npm package: @slate-serializers/dom
Description: Serialize Slate JSON objects to the DOM. Can be used with `htmlparser2` and associated utilities to modify the DOM and generate HTML. Used by other serializers in this monorepo.
Latest version: 2.2.3

# @slate-serializers/dom

`slateToDom` is used by `slateToHtml` in [`@slate-serializers/html`](packages/html/README.md) before serializing to HTML.

It is made available as a separate serializer for cases where DOM manipulation is desired before serializing to HTML.
npm package: @slate-serializers/template
Description: Render Slate JSON as a combination of HTML and custom serializers that you pass to the configuration.
Latest version: 2.2.3

# @slate-serializers/template

Render Slate JSON as a combination of HTML and custom serializers that you pass to the configuration.

Returns an array. By default, each array element is the output of `@slate-serializers/html`. If you pass a custom serializers, your serialized output will be included in this array. These serializers match on top-level Slate nodes only using the `type` attribute.

## Usage

### slateToTemplate

```ts
import { slateToTemplate } from '@slate-serializers/template'

const slate = [
  {
    children: [
      {
        text: 'Heading 1',
      },
    ],
    type: 'h1',
  },
  {
    children: [
      {
        text: 'Paragraph 1',
      },
    ],
    type: 'p',
  },
]

const serializedToArray = slateToTemplate(slate)
// output
// ["<h1>Heading 1</h1>", "<p>Paragraph 1</p>"]
```

### Configuration

Define a custom serializer to include any output for top-level Slate nodes of a given type.

```ts
const slate = [
  {
    children: [
      {
        text: 'Paragraph',
      },
    ],
    type: 'p',
  },
  {
    children: [
      {
        buttonType: 'primary',
        text: 'Button',
      },
    ],
    type: 'button',
  },
];

const config: SlateToTemplateConfig = {
  ...defaultTemplateConfig,
  customElementSerializers: {
    button: ({ node }) => {
      return () =>
        `<button class="${node.buttonType}">Button HTML string generated by function</button>`;
    },
  },
};

const serializedToArray = slateToTemplate(slate)
// output
// ["<p>Paragraph</p>", [Function]]
```
npm package: @slate-serializers/utilities
Description: This library was generated with [Nx](https://nx.dev).
Latest version: 2.2.3

# utilities

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build utilities` to build the library.

## Running unit tests

Run `nx test utilities` to execute the unit tests via [Jest](https://jestjs.io).