import { jsx } from 'slate-hyperscript'
const deserialize = (el, markAttributes = {}) => {
if (el.nodeType === Node.TEXT_NODE) {
return jsx('text', markAttributes, el.textContent)
} else if (el.nodeType !== Node.ELEMENT_NODE) {
const nodeAttributes = { ...markAttributes }
// define attributes for text nodes
nodeAttributes.bold = true
const children = Array.from(el.childNodes)
.map(node => deserialize(node, nodeAttributes))
if (children.length === 0) {
children.push(jsx('text', nodeAttributes, ''))
return jsx('fragment', {}, children)
return jsx('element', { type: 'quote' }, children)
return jsx('element', { type: 'paragraph' }, children)
{ type: 'link', url: el.getAttribute('href') },