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.
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
Schema:
valid_elements
valid_classes
valid_children
valid_styles
(usetinymce.html.Parser
for this option to work, nottinymce.html.DomParser
)extended_valid_elements
invalid_elements
custom_elements
schema
("html5"
,"html4"
,"html5-strict"
)
Parser:
Serializer:
indent
indent_before
indent_after