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

rebber

Package Overview
Dependencies
Maintainers
3
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 5.1.2 to 5.2.0

3

dist/one.js

@@ -20,5 +20,2 @@ "use strict";

handlers.emphasis = require('./types/emphasis');
handlers.footnote = require('./types/footnote');
handlers.footnoteDefinition = require('./types/footnoteDefinition');
handlers.footnoteReference = require('./types/footnoteReference');
handlers.heading = require('./types/heading');

@@ -25,0 +22,0 @@ handlers.html = require('./types/html');

5

dist/preprocessors/index.js

@@ -7,4 +7,2 @@ "use strict";

var headingPlugin = require('./headingVisitor');
var referenceVisitors = require('./referenceVisitors');

@@ -21,4 +19,3 @@

definition: [definitionVisitor],
imageReference: [imageReferenceVisitor],
heading: [headingPlugin]
imageReference: [imageReferenceVisitor]
};

@@ -25,0 +22,0 @@ var visitors = xtend(defaultVisitors, ctx.preprocessors || {});

@@ -5,39 +5,7 @@ "use strict";

module.exports = code;
var codeBlockParamsMapping = [null, 'hl_lines=', 'linenostart='];
var defaultMacro = function defaultMacro(content, lang, attrs) {
var defaultMacro = function defaultMacro(content, lang) {
// Default language is "text"
if (!lang) lang = 'text'; // Create a list of attributes to be serialized
var localCodeBlockParams = Array(codeBlockParamsMapping.length).fill(''); // Check for attributes and enumerate them
if (attrs !== null) {
for (var i = 0; i < codeBlockParamsMapping.length; i++) {
var _param = codeBlockParamsMapping[i]; // Skip unwanted parameters
if (_param === null) continue;
var location = attrs.indexOf(_param); // Parse the attributes we know
if (location > -1) {
var begin = location + _param.length;
var remaining = attrs.slice(begin);
var length = remaining.indexOf(' ');
var value = length > -1 ? attrs.slice(begin, begin + length) : remaining; // Remove string-delimiters
if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
value = value.slice(1, -1).trim();
}
localCodeBlockParams[i] = value;
}
}
} // If we matched something, return optional arguments
// Note that we do stop serialization on a chain of empty arguments
var matched = localCodeBlockParams.reduce(function (a, v, i) {
return v !== '' ? i : a;
}, -1) + 1;
var param = matched > 0 ? "[".concat(localCodeBlockParams.slice(0, matched).join(']['), "]") : '';
return "\\begin{CodeBlock}".concat(param, "{").concat(lang, "}\n").concat(content, "\n\\end{CodeBlock}\n\n");
if (!lang) lang = 'text';
return "\\begin{CodeBlock}{".concat(lang, "}\n").concat(content, "\n\\end{CodeBlock}\n\n");
};

@@ -49,5 +17,5 @@ /* Stringify a code `node`. */

var macro = ctx.code || defaultMacro;
return "".concat(macro(node.value, node.lang, node.meta, node));
return "".concat(macro(node.value, node.lang, node.meta));
}
code.macro = defaultMacro;

@@ -9,2 +9,10 @@ "use strict";

var defaultCheckedMacro = function defaultCheckedMacro(innerText) {
return "\\item[$\\boxtimes$]\\relax ".concat(innerText, "\n");
};
var defaultUncheckedMacro = function defaultUncheckedMacro(innerText) {
return "\\item[$\\square$]\\relax ".concat(innerText, "\n");
};
module.exports = listItem;

@@ -14,3 +22,10 @@

var rebberListItem = has(ctx, 'listItem') ? ctx.listItem : defaultMacro;
if (node.checked === true) {
rebberListItem = has(ctx, 'checkedListItem') ? ctx.checkedListItem : defaultCheckedMacro;
} else if (node.checked === false) {
rebberListItem = has(ctx, 'uncheckedListItem') ? ctx.uncheckedListItem : defaultUncheckedMacro;
}
return rebberListItem(require('../all')(ctx, node).trim());
}
"use strict";
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
var clone = require('clone');

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

{
"name": "rebber",
"version": "5.1.2",
"version": "5.2.0",
"description": "Stringifies MDAST to LaTeX",

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

],
"engines": {
"node": ">=4"
},
"keywords": [

@@ -38,7 +35,7 @@ "mdast",

"has": "^1.0.3",
"mdast-util-definitions": "^2.0.0",
"trim-lines": "^1.0.0",
"mdast-util-definitions": "^3.0.1",
"trim-lines": "^1.1.3",
"xtend": "^4.0.2"
},
"gitHead": "ea21dd5ea5e5886410459e103728975be1992486"
"gitHead": "7dfdfdf98ac64c3867791036ab0cf1ce45918e40"
}

@@ -6,2 +6,13 @@ # rebber [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status]

## remark-rebber version compatibility
Starting from version 8.0.0, `remark` dropped support for footnotes; hence, `rebber` also dropped it's support starting from version 6.0.0.
Therefore, we have the following compatibility table for remark-rebber versions:
| remark | rebber |
| ------- | ------- |
| < 8.0.0 | < 6.0.0 |
| > 8.0.0 | any |
## Installation

@@ -8,0 +19,0 @@

@@ -17,5 +17,2 @@ /* Dependencies. */

handlers.emphasis = require('./types/emphasis')
handlers.footnote = require('./types/footnote')
handlers.footnoteDefinition = require('./types/footnoteDefinition')
handlers.footnoteReference = require('./types/footnoteReference')
handlers.heading = require('./types/heading')

@@ -22,0 +19,0 @@ handlers.html = require('./types/html')

const xtend = require('xtend')
const visit = require('unist-util-visit')
const headingPlugin = require('./headingVisitor')
const referenceVisitors = require('./referenceVisitors')

@@ -15,3 +14,2 @@

imageReference: [imageReferenceVisitor],
heading: [headingPlugin],
}

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

/* Expose. */
module.exports = code
const codeBlockParamsMapping = [
null,
'hl_lines=',
'linenostart=',
]
const defaultMacro = (content, lang, attrs) => {
const defaultMacro = (content, lang) => {
// Default language is "text"
if (!lang) lang = 'text'
// Create a list of attributes to be serialized
const localCodeBlockParams = Array(codeBlockParamsMapping.length).fill('')
// Check for attributes and enumerate them
if (attrs !== null) {
for (let i = 0; i < codeBlockParamsMapping.length; i++) {
const param = codeBlockParamsMapping[i]
// Skip unwanted parameters
if (param === null) continue
const location = attrs.indexOf(param)
// Parse the attributes we know
if (location > -1) {
const begin = location + param.length
const remaining = attrs.slice(begin)
const length = remaining.indexOf(' ')
let value = length > -1 ? attrs.slice(begin, begin + length) : remaining
// Remove string-delimiters
if (
(value.startsWith('"') && value.endsWith('"')) ||
(value.startsWith("'") && value.endsWith("'"))
) {
value = value.slice(1, -1).trim()
}
localCodeBlockParams[i] = value
}
}
}
// If we matched something, return optional arguments
// Note that we do stop serialization on a chain of empty arguments
const matched = localCodeBlockParams.reduce((a, v, i) => v !== '' ? i : a, -1) + 1
const param = matched > 0 ? `[${localCodeBlockParams.slice(0, matched).join('][')}]` : ''
return `\\begin{CodeBlock}${param}{${lang}}\n${content}\n\\end{CodeBlock}\n\n`
return `\\begin{CodeBlock}{${lang}}\n${content}\n\\end{CodeBlock}\n\n`
}

@@ -56,5 +14,5 @@

const macro = ctx.code || defaultMacro
return `${macro(node.value, node.lang, node.meta, node)}`
return `${macro(node.value, node.lang, node.meta)}`
}
code.macro = defaultMacro
const has = require('has')
const defaultMacro = (innerText) => `\\item\\relax ${innerText}\n`
const defaultCheckedMacro = (innerText) => `\\item[$\\boxtimes$]\\relax ${innerText}\n`
const defaultUncheckedMacro = (innerText) => `\\item[$\\square$]\\relax ${innerText}\n`

@@ -8,5 +10,9 @@ module.exports = listItem

function listItem (ctx, node) {
const rebberListItem = has(ctx, 'listItem') ? ctx.listItem : defaultMacro
let rebberListItem = has(ctx, 'listItem') ? ctx.listItem : defaultMacro
if (node.checked === true) {
rebberListItem = has(ctx, 'checkedListItem') ? ctx.checkedListItem : defaultCheckedMacro
} else if (node.checked === false) {
rebberListItem = has(ctx, 'uncheckedListItem') ? ctx.uncheckedListItem : defaultUncheckedMacro
}
return rebberListItem(require('../all')(ctx, node).trim())
}
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