Comparing version 3.1.5 to 4.0.0
@@ -25,5 +25,4 @@ "use strict"; | ||
'~': '\\textasciitilde{}' | ||
/* Encode special characters in `value`. */ | ||
}; | ||
/* Encode special characters in `value`. */ | ||
@@ -30,0 +29,0 @@ function encode(value) { |
"use strict"; | ||
/* Expose. */ | ||
module.exports = code; | ||
var detab = require('detab'); | ||
@@ -26,5 +25,6 @@ var defaultMacro = function defaultMacro(content, lang) { | ||
function code(ctx, node) { | ||
module.exports = function code(ctx, node) { | ||
var value = node.value ? detab("".concat(node.value, "\n")) : ''; | ||
var macro = ctx.code || defaultMacro; | ||
return macro(node.value, node.lang); | ||
} | ||
return macro(value, node.lang); | ||
}; |
"use strict"; | ||
// TODO: make it customizable | ||
var collapse = require('collapse-white-space'); | ||
/* Expose. */ | ||
module.exports = inlineCode; | ||
var escape = require('../escaper'); | ||
function inlineCode(ctx, node) { | ||
var finalCode = escape(node.value); | ||
module.exports = function inlineCode(ctx, node) { | ||
var finalCode = escape(collapse(node.value)); | ||
return "\\texttt{".concat(finalCode, "}"); | ||
} | ||
}; |
"use strict"; | ||
/* Dependencies. */ | ||
var trimLines = require('trim-lines'); | ||
var escaper = require('../escaper'); | ||
/* Expose. */ | ||
/* Stringify a text `node`. */ | ||
module.exports = text; | ||
/* Stringify a text `node`. */ | ||
function text(ctx, node, index, parent) { | ||
var value = node.value; | ||
module.exports = function text(ctx, node, index, parent) { | ||
var value = trimLines(node.value); | ||
return isLiteral(parent) ? value : escaper(value, ctx.escapes); | ||
} // TODO: `tagName` isn't part of MDAST! | ||
}; // TODO: `tagName` isn't part of MDAST! | ||
@@ -16,0 +15,0 @@ /* Check if content of `node` should not be escaped. */ |
{ | ||
"name": "rebber", | ||
"version": "3.1.5", | ||
"version": "4.0.0", | ||
"description": "Stringifies MDAST to LaTeX", | ||
@@ -34,7 +34,10 @@ "repository": "https://github.com/zestedesavoir/zmarkdown/tree/master/packages/rebber", | ||
"dependencies": { | ||
"collapse-white-space": "^1.0.5", | ||
"detab": "^2.0.2", | ||
"has": "^1.0.1", | ||
"mdast-util-definitions": "^1.2.3", | ||
"trim-lines": "^1.1.2", | ||
"xtend": "^4.0.1" | ||
}, | ||
"gitHead": "b05f25a9f9f7be3c2987fb3c07f48cc1b43ca2aa" | ||
"gitHead": "83d21c0fd4a36065ebd1023c7083827939d32cea" | ||
} |
@@ -1,3 +0,2 @@ | ||
/* Expose. */ | ||
module.exports = code | ||
const detab = require('detab') | ||
@@ -22,5 +21,6 @@ const defaultMacro = (content, lang) => { | ||
/* Stringify a Blockquote `node`. */ | ||
function code (ctx, node) { | ||
module.exports = function code (ctx, node) { | ||
const value = node.value ? detab(`${node.value}\n`) : '' | ||
const macro = ctx.code || defaultMacro | ||
return macro(node.value, node.lang) | ||
return macro(value, node.lang) | ||
} |
@@ -1,10 +0,7 @@ | ||
// TODO: make it customizable | ||
/* Expose. */ | ||
module.exports = inlineCode | ||
const collapse = require('collapse-white-space') | ||
const escape = require('../escaper') | ||
function inlineCode (ctx, node) { | ||
const finalCode = escape(node.value) | ||
module.exports = function inlineCode (ctx, node) { | ||
const finalCode = escape(collapse(node.value)) | ||
return `\\texttt{${finalCode}}` | ||
} |
/* Dependencies. */ | ||
const trimLines = require('trim-lines') | ||
const escaper = require('../escaper') | ||
/* Expose. */ | ||
module.exports = text | ||
/* Stringify a text `node`. */ | ||
function text (ctx, node, index, parent) { | ||
const value = node.value | ||
module.exports = function text (ctx, node, index, parent) { | ||
const value = trimLines(node.value) | ||
@@ -11,0 +9,0 @@ return isLiteral(parent) ? value : escaper(value, ctx.escapes) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46774
6
1142
+ Addedcollapse-white-space@^1.0.5
+ Addeddetab@^2.0.2
+ Addedtrim-lines@^1.1.2
+ Addedcollapse-white-space@1.0.6(transitive)
+ Addeddetab@2.0.4(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedtrim-lines@1.1.3(transitive)