New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

convert-rich-text

Package Overview
Dependencies
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

convert-rich-text - npm Package Compare versions

Comparing version 4.0.1 to 5.0.0

lib/export/to_html.js

27

browser.js

@@ -1,6 +0,25 @@

var convert = require('./lib/convert');
var toHtml = require('./lib/export/to_html');
var toInlineHtml = require('./lib/export/to_inline_html');
var toInternalHtml = require('./lib/export/to_internal_html');
var toPublicHtml = require('./lib/export/to_public_html');
var toPlaintext = require('./lib/export/to_plaintext');
module.exports = function(delta, formats, options) {
options.document = document;
return convert(delta, formats, options);
module.exports = {
toHtml: function(delta, formats, options) {
options = Object.assign({}, options, { document: document });
return toHtml(delta, formats, options);
},
toInlineHtml: function(delta, formats, options) {
options = Object.assign({}, options, { document: document });
return toInlineHtml(delta, formats, options);
},
toInternalHtml: function(delta, formats, options) {
options = Object.assign({}, options, { document: document });
return toInternalHtml(delta, formats, options);
},
toPublicHtml: function(delta, formats, options) {
options = Object.assign({}, options, { document: document });
return toPublicHtml(delta, formats, options);
},
toPlaintext: toPlaintext
};
var JSDOM = require('jsdom').JSDOM;
var convert = require('./lib/convert');
var toHtml = require('./lib/export/to_html');
var toInlineHtml = require('./lib/export/to_inline_html');
var toInternalHtml = require('./lib/export/to_internal_html');
var toPublicHtml = require('./lib/export/to_public_html');
var toPlaintext = require('./lib/export/to_plaintext');
module.exports = function(delta, formats, options) {
options.document = new JSDOM().window.document;
return convert(delta, formats, options);
module.exports = {
toHtml: function(delta, formats, options) {
options = Object.assign({}, options, { document: new JSDOM().window.document });
return toHtml(delta, formats, options);
},
toInlineHtml: function(delta, formats, options) {
options = Object.assign({}, options, { document: new JSDOM().window.document });
return toInlineHtml(delta, formats, options);
},
toInternalHtml: function(delta, formats, options) {
options = Object.assign({}, options, { document: new JSDOM().window.document });
return toInternalHtml(delta, formats, options);
},
toPublicHtml: function(delta, formats, options) {
options = Object.assign({}, options, { document: new JSDOM().window.document });
return toPublicHtml(delta, formats, options);
},
toPlaintext: toPlaintext
};

4

package.json
{
"name": "convert-rich-text",
"version": "4.0.1",
"version": "5.0.0",
"description": "Convert an insert-only rich-text delta into HTML",

@@ -9,3 +9,3 @@ "main": "index.js",

"lint": "jshint --verbose .",
"test": "npm run lint && NODE_ENV=test karma start && NODE_ENV=test mocha test/server/server.js -R spec"
"test": "npm run lint && NODE_ENV=test karma start && NODE_ENV=test mocha test/server/*.js -R spec"
},

@@ -12,0 +12,0 @@ "repository": {

@@ -49,3 +49,3 @@ exports.formats = {

delta: { ops: [
{insert: 'Hello world\n'}
{ insert: 'Hello world\n' }
]},

@@ -58,5 +58,5 @@ expected:

delta: { ops: [
{insert: 'Hello, '},
{insert: 'World!', attributes: {bold: true}},
{insert: '\n'}
{ insert: 'Hello, ' },
{ insert: 'World!', attributes: { bold: true } },
{ insert: '\n' }
]},

@@ -69,9 +69,9 @@ expected:

delta: { ops: [
{insert: 'Hello, World!\nThis is a second line.', attributes: {bold: true}},
{insert: '\n', attributes: {firstheader: true}},
{insert: 'This is a demo of convert-rich-text '},
{insert: {image: 'http://i.imgur.com/2ockv.gif'}},
{insert: ' '},
{insert: 'Google', attributes: {link: 'https://www.google.com'}},
{insert: '\n'}
{ insert: 'Hello, World!\nThis is a second line.', attributes: { bold: true } },
{ insert: '\n', attributes: { firstheader: true } },
{ insert: 'This is a demo of convert-rich-text ' },
{ insert: { image: 'http://i.imgur.com/2ockv.gif' } },
{ insert: ' ' },
{ insert: 'Google', attributes: { link: 'https://www.google.com' } },
{ insert: '\n' }
]},

@@ -88,4 +88,4 @@ expected:

delta: { ops: [
{insert: 'Hello world', attributes: { color: 'red', user: 1234 }},
{insert: '\n'}
{ insert: 'Hello world', attributes: { color: 'red', user: 1234 } },
{ insert: '\n' }
]},

@@ -100,4 +100,4 @@ expected: {

delta: { ops: [
{insert: 'hello world', attributes: { className: 'greeting' }},
{insert: '\n'}
{ insert: 'hello world', attributes: { className: 'greeting' } },
{ insert: '\n' }
]},

@@ -110,10 +110,10 @@ expected:

delta: { ops: [
{insert: 'Consecutive list elements'},
{insert: '\n', attributes: {list: true}},
{insert: 'Should create a parent tag'},
{insert: '\n', attributes: {list: true}},
{insert: 'Consecutive bullet elements'},
{insert: '\n', attributes: {bullet: true}},
{insert: 'Should create a parent tag'},
{insert: '\n', attributes: {bullet: true}}
{ insert: 'Consecutive list elements' },
{ insert: '\n', attributes: { list: true } },
{ insert: 'Should create a parent tag' },
{ insert: '\n', attributes: { list: true } },
{ insert: 'Consecutive bullet elements' },
{ insert: '\n', attributes: { bullet: true } },
{ insert: 'Should create a parent tag' },
{ insert: '\n', attributes: { bullet: true } }
]},

@@ -129,6 +129,6 @@ expected:

delta: { ops: [
{attributes:{bold:true},insert:'hello'},
{insert:' '},
{attributes:{link:'http://vox.com'},insert:'world'},
{insert:' this works...?\n'}
{ attributes: { bold: true }, insert:'hello' },
{ insert: ' ' },
{ attributes: { link: 'http://vox.com' }, insert:'world' },
{ insert:' this works...?\n' }
]},

@@ -141,6 +141,6 @@ expected:

delta: { ops: [
{insert: 'Some text '},
{insert: 'a link', attributes: {link: 'http://vox.com'}},
{insert: ' more text'},
{insert: '\n', attributes: {list: true}}
{ insert: 'Some text ' },
{ insert: 'a link', attributes: { link: 'http://vox.com' } },
{ insert: ' more text' },
{ insert: '\n', attributes: { list: true } }
]},

@@ -153,4 +153,4 @@ expected:

delta: { ops: [
{insert: 'hello world', attributes: { parent: 'article' } },
{insert: '\n', attributes: { firstheader: true } }
{ insert: 'hello world', attributes: { parent: 'article' } },
{ insert: '\n', attributes: { firstheader: true } }
]},

@@ -163,6 +163,6 @@ expected:

delta: { ops: [
{insert: 'Hello World!', attributes: {reverse: true}},
{insert: '\n'},
{insert: 'Foo Bar Baz', attributes: {bold: true, repeat: 3}},
{insert: '\n', attributes: { data: {foo: 'bar'}}}
{ insert: 'Hello World!', attributes: { reverse: true } },
{ insert: '\n' },
{ insert: 'Foo Bar Baz', attributes: { bold: true, repeat: 3 } },
{ insert: '\n', attributes: { data: { foo: 'bar' } } }
]},

@@ -175,3 +175,3 @@ expected:

desc: 'Change default blockTag',
delta: { ops: [{insert: 'Hello world'}]},
delta: { ops: [{ insert: 'Hello world' }]},
opts: { blockTag: 'P' },

@@ -182,5 +182,5 @@ expected: '<p>Hello world</p>'

desc: 'Line formats with no contents',
delta: { ops: [{insert: '\n', attributes: {firstheader: true} }] },
delta: { ops: [{ insert: '\n', attributes: { firstheader: true } }] },
expected: '<h1></h1>'
}
];
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc