JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 31
  • Score
    100M100P100Q48016F
  • License LGPL-2.1

HTML parsing, filtering and serialization logic extracted from TinyMCE

Package Exports

  • tinymce.html

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tinymce.html) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

tinymce.html

TinyMCE includes sophisticated logic for cleaning up HTML content. What's interesting about this logic is that it's pure JavaScript. It doesn't use any browser-specific APIs and can be used with Node.js.

Build Status npm

Example

var tinymce = require('tinymce.html');

var schema = new tinymce.html.Schema({
    valid_elements: "@[class],#p,span,a[!href],strong/b",
    valid_classes: "foo"
});

var parser = new tinymce.html.Parser({
    forced_root_block: 'p'
}, schema);

var serializer = new tinymce.html.Serializer({
    indent: true,
    indent_before: 'p',
    indent_after: 'p'
}, schema);

var html = '<B title="title" class="foo bar">test</B><a href="//tinymce.com">' +
    'TinyMCE</a><p>Lorem <a>Ipsum</a></p>';
var root = parser.parse(initialHtml);
var result = serializer.serialize(root);

console.log(result);
// <p><strong class="foo">test</strong><a href="//tinymce.com">TinyMCE</a></p>
// <p>Lorem Ipsum</p>

Options