const sanitizeHtml = require('sanitize-html'); function transform(content) { const result = sanitizeHtml(content, { allowedTags: [ 'h4', 'h5', 'h6', 'blockquote', 'p', 'a', 'ul', 'ol', 'li', 'b', 'i', 'strong', 'em', 'strike', 's', 'del', 'abbr', 'code', 'hr', 'br', 'div', 'table', 'thead', 'caption', 'tbody', 'tr', 'th', 'td', 'pre', 'section', 'img', 'figure', 'figcaption', 'span', 'label', 'input', ], nonTextTags: [ 'style', 'script', 'textarea', 'option', 'h1', 'h2', 'h3', 'nav' ], allowedAttributes: { 'a': [ 'href', 'class', 'data-note-path' ], 'img': [ 'src' ], 'section': [ 'class', 'data-note-id' ], 'figure': [ 'class' ], 'span': [ 'class', 'style' ], 'label': [ 'class' ], 'input': [ 'class', 'type', 'disabled' ], 'code': [ 'class' ], 'ul': [ 'class' ], 'table': [ 'class' ], 'en-media': [ 'hash' ] }, allowedSchemes: ['http', 'https', 'ftp', 'mailto', 'data', 'evernote'], transformTags: { // 'h5': sanitizeHtml.simpleTransform('strong', {}, false), 'table': sanitizeHtml.simpleTransform('table', {}, false) }, }); return result.replace(/