Socket
Socket
Sign inDemoInstall

article-json-html-render

Package Overview
Dependencies
8
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.2.1 to 2.3.0

10

dist/text.js

@@ -50,2 +50,11 @@ 'use strict';

var wrapStrikethrough = function wrapStrikethrough(_ref5, el) {
var strikethrough = _ref5.strikethrough;
return strikethrough ? (0, _magicVirtualElement2.default)(
's',
null,
el
) : el;
};
var renderItem = function renderItem(item) {

@@ -56,2 +65,3 @@ if (item.type === 'text') {

el = wrapBold(item, el);
el = wrapStrikethrough(item, el);
el = wrapHref(item, el);

@@ -58,0 +68,0 @@ el = wrapMark(item, el);

11

lib/text.js
import element from 'magic-virtual-element';
const wrapMark = ({mark, markClass}, el) =>
mark ? <mark class={markClass || null}>{el}</mark> : el;
(mark ? <mark class={markClass || null}>{el}</mark> : el);
const wrapHref = ({href}, el) => href ? <a href={href}>{el}</a> : el;
const wrapHref = ({href}, el) => (href ? <a href={href}>{el}</a> : el);
const wrapBold = ({bold}, el) => bold ? <b>{el}</b> : el;
const wrapBold = ({bold}, el) => (bold ? <b>{el}</b> : el);
const wrapItalic = ({italic}, el) => italic ? <i>{el}</i> : el;
const wrapItalic = ({italic}, el) => (italic ? <i>{el}</i> : el);
const wrapStrikethrough = ({strikethrough}, el) => (strikethrough ? <s>{el}</s> : el);
const renderItem = (item) => {

@@ -17,2 +19,3 @@ if (item.type === 'text') {

el = wrapBold(item, el);
el = wrapStrikethrough(item, el);
el = wrapHref(item, el);

@@ -19,0 +22,0 @@ el = wrapMark(item, el);

{
"name": "article-json-html-render",
"version": "2.2.1",
"version": "2.3.0",
"description": "Base for html-based article-json renderer, such as [article-json-to-amp](https://www.npmjs.com/package/article-json-to-amp)",

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

@@ -131,4 +131,6 @@ import test from 'tape';

{type: 'text', content: 'fiz', bold: true},
{type: 'text', content: 'fuz', strikethrough: true},
{type: 'text', content: 'fyz', mark: true},
{type: 'text', content: 'faz', italic: true, bold: true,
href: 'http://mic.com'}
mark: true, strikethrough: true, href: 'http://mic.com'}
]

@@ -144,3 +146,5 @@ }

<b>fiz</b>
<a href='http://mic.com'><b><i>faz</i></b></a>
<s>fuz</s>
<mark>fyz</mark>
<mark><a href='http://mic.com'><s><b><i>faz</i></b></s></a></mark>
</p>

@@ -147,0 +151,0 @@ </article>));

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc