How to use @sanity/block-content-to-hyperscript - 3 common examples

To help you get started, we’ve selected a few @sanity/block-content-to-hyperscript examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rdunk / sanity-blocks-vue-component / src / blocksToVue.js View on Github external
vueProps = data.node
        sanityProps._sanityProps = {
          node: data.node,
          options: data.options
        }
      }
      const props = objectAssign({}, vueProps, sanityProps)
      data = {props}
    }

    return createElement(tag, data, childNodes)
  }

  const {defaultSerializers, serializeSpan} = getSerializers(renderNode)

  return blocksToNodes(renderNode, options, defaultSerializers, serializeSpan)
}
github rdunk / sanity-blocks-vue-component / src / serializers.js View on Github external
function ImageSerializer(props) {
    const img = h('img', {
      attrs: {
        src: getImageUrl(props)
      }
    })
    return props.isInline ? img : h('figure', null, img)
  }
github sanity-io / block-content-to-react / src / targets / dom.js View on Github external
const React = require('react')
const {getSerializers} = require('@sanity/block-content-to-hyperscript/internals')

const renderNode = React.createElement
const {defaultSerializers, serializeSpan} = getSerializers(renderNode)

module.exports = {
  serializeSpan,
  serializers: defaultSerializers,
  renderProps: {nestMarks: true}
}

@sanity/block-content-to-hyperscript

Function for transforming Sanity block content to HyperScript

MIT
Latest version published 4 years ago

Package Health Score

50 / 100
Full package analysis