@kaliber/html-to-portable-text

3.0.2 • Public • Published

Kaliber HTML to portableText plugin

A plugin for converting html to portableText

Usage

htmlToPortableText(html, overrides = {})

const htmlToPortableText = require('@kaliber/html-to-portable-text')

const portableText = processHTML('<p><h1>This</strong><em>is HTML</em></p>')

function processHTML(html) {
  return removeUndefinedValues(htmlToPortableText(html, { h1: 'heading', h2: 'subheading' }))
}

function removeUndefinedValues(o) {
  return JSON.parse(JSON.stringify(o))
}

Development

> yarn
> yarn link
> yarn watch
yarn link @kaliber/html-to-portable-text

Publish

yarn publish
git push
git push --tags

Disclaimer

This library is intended for internal use, we provide no support, use at your own risk. It does not import React, but expects it to be provided, which @kaliber/build can handle for you.

This library is not transpiled.

Package Sidebar

Install

npm i @kaliber/html-to-portable-text

Weekly Downloads

4

Version

3.0.2

License

MIT

Unpacked Size

8.2 kB

Total Files

7

Last publish

Collaborators

  • erwin-kaliber
  • melissabos18
  • janbru
  • albertkaliber
  • jerryduijm
  • hjsielcken
  • kaliber-owner
  • daveykropf
  • eecolor
  • larsvankleef