Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remark-captions

Package Overview
Dependencies
Maintainers
2
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-captions - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

32

dist/index.js

@@ -56,2 +56,34 @@ 'use strict';

});
visit(tree, 'figure', function (figure, index, parent) {
if (parent.type === 'paragraph') {
if (index === 0) {
parent.type = figure.type;
parent.data = figure.data;
parent.children = figure.children;
return;
}
parent.type = 'tempWrapper';
}
});
visit(tree, 'tempWrapper', function (wrapper, index, parent) {
var _parent$children;
var newChildren = [];
wrapper.children.forEach(function (node, i) {
var child = clone(node);
if (child.type === 'figure') {
newChildren.push(child);
return;
}
if (child.type === 'text' && !child.value.trim()) {
return;
} else if (child.type === 'text') {
child.value = child.value.trim();
}
wrapper.children[i].type = 'paragraph';
wrapper.children[i].children = [child];
newChildren.push(wrapper.children[i]);
});
(_parent$children = parent.children).splice.apply(_parent$children, [index, 1].concat(newChildren));
});
};

@@ -58,0 +90,0 @@ }

16

package.json
{
"name": "remark-captions",
"version": "2.0.1",
"version": "2.1.0",
"repository": {

@@ -36,18 +36,18 @@ "url": "https://github.com/zestedesavoir/zmarkdown/tree/master/packages/remark-captions",

"clone": "^2.1.1",
"unist-util-visit": "^1.1.3"
"unist-util-visit": "^1.3.1"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-jest": "^22.0.4",
"babel-jest": "^23.4.0",
"babel-preset-env": "^1.6.1",
"cross-env": "^5.0.5",
"cross-env": "^5.2.0",
"dedent": "^0.7.0",
"del-cli": "^1.0.0",
"eslint": "^4.5.0",
"jest": "^22.0.5",
"rehype-stringify": "^3.0.0",
"eslint": "^5.1.0",
"jest": "^23.4.1",
"rehype-stringify": "^4.0.0",
"remark-parse": "^5.0.0",
"remark-rehype": "^3.0.0",
"unified": "^6.1.5"
"unified": "^7.0.0"
}
}

@@ -52,2 +52,32 @@ const clone = require('clone')

visit(tree, nodeType, externLegendVisitorCreator(externalBlocks)))
visit(tree, 'figure', (figure, index, parent) => {
if (parent.type === 'paragraph') {
if (index === 0) {
parent.type = figure.type
parent.data = figure.data
parent.children = figure.children
return
}
parent.type = 'tempWrapper'
}
})
visit(tree, 'tempWrapper', (wrapper, index, parent) => {
const newChildren = []
wrapper.children.forEach((node, i) => {
const child = clone(node)
if (child.type === 'figure') {
newChildren.push(child)
return
}
if (child.type === 'text' && !child.value.trim()) {
return
} else if (child.type === 'text') {
child.value = child.value.trim()
}
wrapper.children[i].type = 'paragraph'
wrapper.children[i].children = [child]
newChildren.push(wrapper.children[i])
})
parent.children.splice(index, 1, ...newChildren)
})
}

@@ -54,0 +84,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