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

rebber

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rebber - npm Package Compare versions

Comparing version 0.0.20 to 0.0.21

dist/custom-types/abbr.js

32

dist/custom-types/figure.js

@@ -5,2 +5,3 @@ 'use strict';

var all = require('../all');
var one = require('../one');
var has = require('has');

@@ -25,2 +26,7 @@

return innerText;
},
image: function image(_, caption, extra) {
var width = extra.width ? '[' + extra.width + ']' : '';
return '\\begin{center}\n \\includegraphics' + width + '{' + extra.url + '}\n\\captionof{' + caption + '}\n\\end{center}';
}

@@ -40,16 +46,19 @@ };

return extra;
},
image: function image(node) {
node.witdth = '\\linewidth';
return node;
}
/* Stringify a Figure `node`. */
};function figure(ctx, node) {
};function figure(ctx, node, index, parent) {
var type = node.children[0].type;
var macro = has(ctx, 'figure') && has(ctx.figure, type) && ctx.figure[type] || has(defaultMacros, type) && defaultMacros[type];
if (!macro) return;
var caption = '';
if (node.children.length) {
caption = node.children.filter(function (node) {
return node.type === 'figcaption';
}).map(function (node) {
return all(ctx, node);
caption = node.children.filter(function (captionNode) {
return captionNode.type === 'figcaption';
}).map(function (captionNode) {
return all(ctx, captionNode);
}).join('');

@@ -59,3 +68,6 @@ }

node.caption = caption; // allows to add caption to the default processing
if (!macro) {
node.children[0].caption = caption;
return one(ctx, node.children[0], 0, node);
}
node.children = node.children.filter(function (node) {

@@ -67,5 +79,5 @@ return node.type !== 'figcaption';

}
var innerText = all(ctx, node) || node.value;
return macro(innerText.trim(), caption, makeExtra[type](node));
var extra = has(makeExtra, type) ? makeExtra[type](node) : undefined;
var innerText = all(ctx, node) || node.value || '';
return macro(innerText.trim(), caption, extra);
}

@@ -6,2 +6,3 @@ 'use strict';

var one = require('./one');
var preprocess = require('./pre-visitors');

@@ -12,4 +13,5 @@ /* Expose. */

/* Stringify the given MDAST node. */
function toLaTeX(node, options) {
return one(options, node);
function toLaTeX(node, options, root) {
preprocess(options, root);
return one(options, node, undefined, undefined, root);
}

@@ -24,4 +26,4 @@

function compiler(tree) {
return toLaTeX(tree, settings);
return toLaTeX(tree, settings, tree);
}
}

@@ -33,5 +33,12 @@ 'use strict';

handlers.thematicBreak = require('./types/thematic-break');
handlers.footnote = require('./types/footnote');
handlers.footnoteDefinition = require('./types/footnoteDefinition');
handlers.footnoteReference = require('./types/footnoteReference');
handlers.linkReference = require('./types/linkReference');
handlers.definition = require('./types/definition');
handlers.tableHeader = require('./types/tableHeader');
handlers.image = require('./types/image');
/* Stringify `node`. */
function one(ctx, node, index, parent) {
function one(ctx, node, index, parent, root) {
var handlersOverride = has(ctx, 'override') ? ctx.override : {};

@@ -50,3 +57,3 @@ var h = xtend(handlers, handlersOverride);

return h[type](ctx, node, index, parent);
return h[type](ctx, node, index, parent, root);
}

@@ -6,6 +6,9 @@ 'use strict';

var defaultMacro = function defaultMacro() {
return ' \\\\\n';
};
/* Stringify a break `node`. */
function br(ctx, node) {
return ' \\\\\n';
var macro = ctx.break ? ctx.break : defaultMacro;
return macro(node);
}

@@ -17,2 +17,3 @@ 'use strict';

function link(ctx, node) {
if (!node.url) return '';
var config = ctx.link || {};

@@ -19,0 +20,0 @@ var macro = has(config, 'macro') ? config.macro : defaultMacro;

@@ -6,4 +6,13 @@ 'use strict';

module.exports = table;
var defaultHeaderParse = function defaultHeaderParse(rows) {
var lengths = rows.map(function (l) {
return l.split('&').length;
});
var cols = lengths.sort(cmp)[0];
var colHeader = '|';
colHeader += 'c|'.repeat(cols);
return colHeader;
};
var defaultMacro = function defaultMacro(ctx, node) {
var headerParse = ctx.headerParse ? ctx.headerParse : defaultHeaderParse;
var parsed = node.children.map(function (n, index) {

@@ -13,11 +22,6 @@ return one(ctx, n, index, node);

var inner = parsed.join('');
var lengths = inner.split('\\hline\n').map(function (l) {
return l.split('&').length;
});
var cols = lengths.sort(cmp)[0];
var colHeader = '|';
colHeader += 'c|'.repeat(cols);
var colHeader = headerParse(parsed);
var addendum = '';
if (node.caption) {
addendum = '\n\\tablecaption{' + node.caption + '}\n';
addendum = '\n\\tableCaption{' + node.caption + '}\n';
}

@@ -24,0 +28,0 @@ return '\\begin{longtabu}{' + colHeader + '} \\hline\n' + inner + addendum + '\\end{longtabu}\n\n';

@@ -13,3 +13,3 @@ 'use strict';

var line = parsed.join(' & ');
return line + '\\\\ \\hline\n';
return line + ' \\\\ \\hline\n';
};

@@ -16,0 +16,0 @@

{
"name": "rebber",
"version": "0.0.20",
"version": "0.0.21",
"description": "Stringifies MDAST to LaTeX",

@@ -44,4 +44,5 @@ "repository": "https://github.com/zestedesavoir/zmarkdown/tree/master/packages/rebber",

"remark-align": "^0.0.22",
"remark-captions": "^0.0.15",
"remark-captions": "^0.0.16",
"remark-emoticons": "^0.0.18",
"remark-grid-tables": "^0.0.8",
"remark-parse": "^3.0.1",

@@ -48,0 +49,0 @@ "remark-sub-super": "^0.0.15",

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