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

@slate-serializers/html

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@slate-serializers/html - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

7

package.json
{
"name": "@slate-serializers/html",
"version": "2.2.1",
"version": "2.2.2",
"type": "commonjs",

@@ -14,6 +14,7 @@ "dependencies": {

"slate-hyperscript": "^0.100.0",
"@slate-serializers/dom": "2.2.1",
"@slate-serializers/dom": "2.2.2",
"tslib": "2.6.3"
},
"main": "./src/index.js"
"main": "./src/index.js",
"types": "./src/index.d.ts"
}

@@ -7,5 +7,13 @@ # @slate-serializers/html

## Table of contents
- [Engineering](#engineering)
- [Install](#install)
- [Usage](#usage)
- [slateToHtml](#slatetohtml)
- [htmlToSlate](#htmltoslate)
## Engineering
For details on how all serializers work, see [Engineering decisions](https://github.com/thompsonsj/slate-serializers/docs/engineering.md).
For details on how all serializers work, see [Engineering decisions](https://github.com/thompsonsj/slate-serializers/blob/main/docs/engineering.md).

@@ -78,10 +86,10 @@ ## Install

You can create your own configuration file that implements your schema. See [packages/dom/src/lib/config/payload.ts](packages/dom/src/lib/config/payload.ts) for an example of how to extend the default configuration or copy [packages/dom/src/lib/config/default.ts](packages/dom/src/lib/config/default.ts) and rewrite it as appropriate.
You can create your own configuration file that implements your schema. See [packages/dom/src/lib/config/payload.ts](https://github.com/thompsonsj/slate-serializers/blob/main/packages/dom/src/lib/config/payload.ts) for an example of how to extend the default configuration or copy [packages/dom/src/lib/config/default.ts](https://github.com/thompsonsj/slate-serializers/blob/main/packages/dom/src/lib/config/default.ts) and rewrite it as appropriate.
| Option | Description | Default |
| - | - | - |
| `markMap` | Map Slate JSON properties to HTML formatting element tags. Accepts an array of HTML element tag names. | See [default config](packages/dom/src/lib/config/default.ts). Example: `{ code: ['pre', 'code'], /* ... */ }` |
| `elementMap` | Map Slate JSON `type` values to HTML element tags. Use `elementTransforms` for more control over the returned element. | See [default config](packages/dom/src/lib/config/default.ts). Example: `{ paragraph: 'p', /* ... */ }` |
| `markMap` | Map Slate JSON properties to HTML formatting element tags. Accepts an array of HTML element tag names. | See [default config](https://github.com/thompsonsj/slate-serializers/blob/main/packages/dom/src/lib/config/default.ts). Example: `{ code: ['pre', 'code'], /* ... */ }` |
| `elementMap` | Map Slate JSON `type` values to HTML element tags. Use `elementTransforms` for more control over the returned element. | See [default config](https://github.com/thompsonsj/slate-serializers/blob/main/packages/dom/src/lib/config/default.ts). Example: `{ paragraph: 'p', /* ... */ }` |
| `markTransforms` | Define transform functions for Slate JSON properties. Overrides and corresponding values in `markMap`. | ``{ fontSize: ({ node }) => { return new Element('span', { style: `font-size:${node.fontSize};` }) } }`` |
| `elementTransforms` | Define transform functions for Slate JSON node types. Overrides and corresponding values in `elementMap`. | See [default config](packages/dom/src/lib/config/default.ts). |
| `elementTransforms` | Define transform functions for Slate JSON node types. Overrides and corresponding values in `elementMap`. | See [default config](https://github.com/thompsonsj/slate-serializers/blob/main/packages/dom/src/lib/config/default.ts). |
| `encodeEntities` | See [cheeriojs/dom-serializer - encodeEntities](https://github.com/cheeriojs/dom-serializer#encodeentities) | `true` |

@@ -142,10 +150,10 @@ | `alwaysEncodeBreakingEntities` | Encode `&`, `<` and `>` regardless of other option settings. | `false` |

You can create your own configuration file that implements your schema. See [packages/html/src/lib/serializers/htmlToSlate/config/payload.ts](packages/html/src/lib/serializers/htmlToSlate/config/payload.ts) for an example of how to extend the default configuration or copy [packages/html/src/lib/serializers/htmlToSlate/config/default.ts](packages/html/src/lib/serializers/htmlToSlate/config/default.ts) and rewrite it as appropriate.
You can create your own configuration file that implements your schema. See [packages/html/src/lib/serializers/htmlToSlate/config/payload.ts](https://github.com/thompsonsj/slate-serializers/blob/main/packages/html/src/lib/serializers/htmlToSlate/config/payload.ts) for an example of how to extend the default configuration or copy [packages/html/src/lib/serializers/htmlToSlate/config/default.ts](https://github.com/thompsonsj/slate-serializers/blob/main/packages/html/src/lib/serializers/htmlToSlate/config/default.ts) and rewrite it as appropriate.
| Option | Description | Default |
| - | - | - |
| `textTags` | Define transform functions for HTML formatting elements. | See [default config](packages/html/src/lib/serializers/htmlToSlate/config/default.ts). Example `{ i: () => ({ italic: true }), /* ... */ }`. |
| `elementTags` | Define transform functions for HTML element tag names. | See [default config](packages/html/src/lib/serializers/htmlToSlate/config/default.ts). Example `{ p: () => ({ type: 'p' }), /* ... */ }`. |
| `textTags` | Define transform functions for HTML formatting elements. | See [default config](https://github.com/thompsonsj/slate-serializers/blob/main/packages/html/src/lib/serializers/htmlToSlate/config/default.ts). Example `{ i: () => ({ italic: true }), /* ... */ }`. |
| `elementTags` | Define transform functions for HTML element tag names. | See [default config](https://github.com/thompsonsj/slate-serializers/blob/main/packages/html/src/lib/serializers/htmlToSlate/config/default.ts). Example `{ p: () => ({ type: 'p' }), /* ... */ }`. |
| `htmlPreProcessString` | Perform operations on the HTML string before serialization. | `(html) => html.replace(/<pre[^>]*>/g, '<code>').replace(/<\/pre>/g, '</code>')` | /* ... */ }`. |
| `filterWhitespaceNodes` | Remove whitespace that does not contribute meaning. | `true` |
| `convertBrToLineBreak` | Convert br tags to a new line character (\n). | `true` |

@@ -18,2 +18,3 @@ "use strict";

'dd', // Lists.
'details', // Similar to block.
'dialog', // Flow content.

@@ -20,0 +21,0 @@ 'dir', // Lists, legacy.

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