Comparing version 3.1.4 to 3.1.5
@@ -6,2 +6,6 @@ "use strict"; | ||
var defaultInlineMatcher = function defaultInlineMatcher(node, parent) { | ||
return parent.type === 'paragraph' && parent.children.length - 1 || parent.type === 'heading'; | ||
}; | ||
var defaultMacro = function defaultMacro(node) { | ||
@@ -41,4 +45,5 @@ /* | ||
var macro = options.image ? options.image : defaultMacro; | ||
var inlineMatcher = options.inlineMatcher ? options.inlineMatcher : defaultInlineMatcher; | ||
if (parent.type === 'paragraph' && parent.children.length - 1) { | ||
if (inlineMatcher(node, parent)) { | ||
macro = options.inlineImage ? options.inlineImage : defaultInline; | ||
@@ -45,0 +50,0 @@ } |
@@ -11,2 +11,4 @@ "use strict"; | ||
var clone = require('clone'); | ||
var one = require('../one'); | ||
@@ -42,3 +44,10 @@ /* Expose. */ | ||
var macro = ctx.table || defaultMacro; | ||
return macro(ctx, node); | ||
var overriddenCtx = clone(ctx); | ||
overriddenCtx.image = overriddenCtx.image ? overriddenCtx.image : {}; | ||
overriddenCtx.image.inlineMatcher = function () { | ||
return true; | ||
}; | ||
return macro(overriddenCtx, node); | ||
} |
{ | ||
"name": "rebber", | ||
"version": "3.1.4", | ||
"version": "3.1.5", | ||
"description": "Stringifies MDAST to LaTeX", | ||
@@ -38,3 +38,3 @@ "repository": "https://github.com/zestedesavoir/zmarkdown/tree/master/packages/rebber", | ||
}, | ||
"gitHead": "41ba346f4cb8a52f3ca658c7c217f578cbfca661" | ||
"gitHead": "b05f25a9f9f7be3c2987fb3c07f48cc1b43ca2aa" | ||
} |
/* Expose. */ | ||
module.exports = image | ||
const defaultInlineMatcher = (node, parent) => { | ||
return (parent.type === 'paragraph' && parent.children.length - 1) || | ||
parent.type === 'heading' | ||
} | ||
const defaultMacro = (node) => { | ||
@@ -43,3 +48,5 @@ /* | ||
let macro = options.image ? options.image : defaultMacro | ||
if (parent.type === 'paragraph' && parent.children.length - 1) { | ||
const inlineMatcher = options.inlineMatcher ? options.inlineMatcher : defaultInlineMatcher | ||
if (inlineMatcher(node, parent)) { | ||
macro = options.inlineImage ? options.inlineImage : defaultInline | ||
@@ -46,0 +53,0 @@ } |
@@ -0,1 +1,3 @@ | ||
const clone = require('clone') | ||
const one = require('../one') | ||
@@ -27,3 +29,8 @@ | ||
const macro = ctx.table || defaultMacro | ||
return macro(ctx, node) | ||
const overriddenCtx = clone(ctx) | ||
overriddenCtx.image = overriddenCtx.image ? overriddenCtx.image : {} | ||
overriddenCtx.image.inlineMatcher = () => true | ||
return macro(overriddenCtx, node) | ||
} |
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
46481
1148