Comparing version 0.3.0 to 0.3.1
@@ -75,5 +75,6 @@ const symbols = { | ||
// handle the first line | ||
output.append(lines.shift()); | ||
output.append(lines[0]); | ||
// now add other lines with spaces between | ||
for (const line of lines) { | ||
const remainingLines = lines.slice(1); | ||
for (const line of remainingLines) { | ||
output.nl().append(line); | ||
@@ -80,0 +81,0 @@ } |
@@ -78,2 +78,18 @@ var vm = require("vm"); | ||
function prepareFlagsForExecution(capture, snippet) { | ||
const appliedFlagsSet = new Set(Object.keys(snippet.flags || {})); | ||
// Determine if the snippet has a flag set that should | ||
// take precedence over the capture mode. If one is found | ||
// do not set the capture mode key - note this is needed | ||
// because currently the modes are exclusive within eval. | ||
const hasExplicitCaptureFlag = ["console", "nowrap", "return"].some(flag => | ||
appliedFlagsSet.has(flag) | ||
); | ||
return hasExplicitCaptureFlag | ||
? { ...snippet.flags } | ||
: { [capture]: true, ...snippet.flags }; | ||
} | ||
function prepareEnvironmentForExecution(flags, global, markdown) { | ||
@@ -228,3 +244,3 @@ const globalsToReplace = []; | ||
const flags = { [capture]: true, ...snippet.flags }; | ||
const flags = prepareFlagsForExecution(capture, snippet); | ||
const cleanup = prepareEnvironmentForExecution(flags, global, markdown); | ||
@@ -231,0 +247,0 @@ |
{ | ||
"name": "evaldown", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Evalute JavaScript snippets in markdown files and output static pages.", | ||
@@ -5,0 +5,0 @@ "main": "lib/Evaldown.js", |
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
42968
1007