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
1
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 0.0.2 to 0.1.0

9

converters/html.js

@@ -7,3 +7,3 @@ var merge = require('merge-recursive');

embed: {
1: '<img src="{image}" alt="{alt}" />'
1: '<img src="{image}"/>'
},

@@ -24,5 +24,3 @@ block: {

underline: '<u>{content}</u>',
strikethrough: '<s>{content}</s>',
color: '<span style="color:{color}">{content}</span>',
font: '<span style="font-family:{font}">{content}</span>',
strikethrough: '<s>{content}</s>'
}

@@ -45,3 +43,4 @@ };

return convertAll(content, attrs, options.block);
}).join('\n');
}).join('\n').replace(/<\/(ul|ol)>\n<\1>/g, '\n');
// TODO: stop doing this hacky regexp shit

@@ -48,0 +47,0 @@ //

{
"name": "convert-rich-text",
"version": "0.0.2",
"version": "0.1.0",
"description": "Facilities for converting an insert-only rich-text delta into various formats like HTML and Markdown",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,3 +5,3 @@ var assert = require('assert');

{
desc: 'HTML',
desc: 'Complex HTML',
format: 'html',

@@ -11,6 +11,5 @@ delta: [

{insert: '\n', attributes: {firstheader: true}},
{insert: 'This is a demo of the Quilljs Renderer'},
{insert: 'This is a demo of convert-rich-text'},
{insert: 1, attributes: {
image: 'monkey.png',
alt: 'Funny monkey picture'
image: 'monkey.png'
}},

@@ -22,5 +21,24 @@ {insert: 'Google', attributes: {link: 'https://www.google.com'}}

'<h1><b>This is a second line.</b></h1>\n' +
'<p>This is a demo of the Quilljs Renderer</p>\n' +
'<p><img src="monkey.png" alt="Funny monkey picture" /></p>\n' +
'<p>This is a demo of convert-rich-text</p>\n' +
'<p><img src="monkey.png"/></p>\n' +
'<p><a href="https://www.google.com">Google</a></p>'
},
{
desc: 'Lists',
format: 'html',
delta: [
{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}}
],
expected:
'<ol><li>Consecutive list elements</li>\n' +
'<li>Should create a parent tag</li></ol>\n' +
'<ul><li>Consecutive bullet elements</li>\n' +
'<li>Should create a parent tag</li></ul>'
}

@@ -31,3 +49,6 @@ ];

it(test.desc, function() {
assert.equal(convert(test.delta, test.format), test.expected);
var result = convert(test.delta, test.format);
// console.log(result);
// console.log(test.expected);
assert.equal(result, test.expected);
});

@@ -34,0 +55,0 @@ });

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