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

remark-captions

Package Overview
Dependencies
Maintainers
1
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 0.0.11 to 0.0.12

98

dist/index.js

@@ -102,56 +102,54 @@ 'use strict';

return function (node, index, parent) {
if (index + 1 < parent.children.length && parent.children[index + 1].type === 'paragraph') {
var legendNode = parent.children[index + 1];
var firstChild = legendNode.children[0];
if (index > parent.children.length || parent.children[index + 1].type !== 'paragraph') return;
var legendNode = parent.children[index + 1];
var firstChild = legendNode.children[0];
if (firstChild.type !== 'text' || !firstChild.value.startsWith(blocks[node.type])) return;
if (firstChild.value.startsWith(blocks[node.type])) {
var legendNodes = [];
var followingNodes = [];
var firstTextLine = firstChild.value.replace(blocks[node.type], '').split('\n')[0];
if (firstChild.value.includes('\n')) {
followingNodes.push({ type: 'text',
value: firstChild.value.replace(blocks[node.type], '').split('\n')[1] });
}
legendNodes.push({
type: 'text',
value: firstTextLine.trimLeft() // remove the " " after the {prefix}:
});
var legendNodes = [];
var followingNodes = [];
var firstTextLine = firstChild.value.replace(blocks[node.type], '').split('\n')[0];
if (firstChild.value.includes('\n')) {
followingNodes.push({ type: 'text',
value: firstChild.value.replace(blocks[node.type], '').split('\n')[1] });
}
legendNodes.push({
type: 'text',
value: firstTextLine.trimLeft() // remove the " " after the {prefix}:
});
legendNode.children.forEach(function (node, index) {
if (index === 0) return;
if (node.type === 'text') {
var keepInLegend = node.value.split('\n')[0];
if (node.value.includes('\n')) {
node.value = node.value.split('\n')[1];
followingNodes.push(node);
}
legendNodes.push({ type: 'text', value: keepInLegend });
} else {
legendNodes.push(clone(node));
}
});
var figcaption = {
type: 'figcaption',
children: legendNodes,
data: {
hName: 'figcaption'
}
};
var figure = {
type: 'figure',
children: [clone(node), figcaption],
data: {
hName: 'figure'
}
};
node.type = figure.type;
node.children = figure.children;
node.data = figure.data;
if (followingNodes.length) {
parent.children.splice(index + 1, 1, { type: 'paragraph', children: followingNodes });
} else {
parent.children.splice(index + 1, 1);
legendNode.children.forEach(function (node, index) {
if (index === 0) return;
if (node.type === 'text') {
var keepInLegend = node.value.split('\n')[0];
if (node.value.includes('\n')) {
node.value = node.value.split('\n')[1];
followingNodes.push(node);
}
legendNodes.push({ type: 'text', value: keepInLegend });
} else {
legendNodes.push(clone(node));
}
});
var figcaption = {
type: 'figcaption',
children: legendNodes,
data: {
hName: 'figcaption'
}
};
var figure = {
type: 'figure',
children: [clone(node), figcaption],
data: {
hName: 'figure'
}
};
node.type = figure.type;
node.children = figure.children;
node.data = figure.data;
if (followingNodes.length) {
parent.children.splice(index + 1, 1, { type: 'paragraph', children: followingNodes });
} else {
parent.children.splice(index + 1, 1);
}

@@ -158,0 +156,0 @@ };

{
"name": "remark-captions",
"version": "0.0.11",
"version": "0.0.12",
"repository": {

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

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