markdown-up 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/app.js +6 -6
- package/lib/script.js +3 -3
- package/lib/scriptLibrary.js +4 -4
- package/package.json +1 -1
package/lib/app.js
CHANGED
|
@@ -286,19 +286,19 @@ export class MarkdownUp {
|
|
|
286
286
|
({markdownText} = this);
|
|
287
287
|
|
|
288
288
|
// Log Markdown render begin
|
|
289
|
-
if ('logFn' in scriptOptions) {
|
|
289
|
+
if ('logFn' in scriptOptions && scriptOptions.debug) {
|
|
290
290
|
timeBegin = performance.now();
|
|
291
291
|
scriptOptions.logFn('MarkdownUp: ===== Rendering Markdown text');
|
|
292
292
|
}
|
|
293
293
|
} else {
|
|
294
294
|
// Log Markdown render begin
|
|
295
|
-
if ('logFn' in scriptOptions) {
|
|
295
|
+
if ('logFn' in scriptOptions && scriptOptions.debug) {
|
|
296
296
|
scriptOptions.logFn(`MarkdownUp: ===== Rendering Markdown document "${url}"`);
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
// Log Markdown fetch begin
|
|
300
300
|
let fetchBegin;
|
|
301
|
-
if ('logFn' in scriptOptions) {
|
|
301
|
+
if ('logFn' in scriptOptions && scriptOptions.debug) {
|
|
302
302
|
fetchBegin = performance.now();
|
|
303
303
|
scriptOptions.logFn(`MarkdownUp: Fetching "${url}" ...`);
|
|
304
304
|
}
|
|
@@ -318,7 +318,7 @@ export class MarkdownUp {
|
|
|
318
318
|
markdownText = await response.text();
|
|
319
319
|
|
|
320
320
|
// Log Markdown fetch end with timing
|
|
321
|
-
if ('logFn' in scriptOptions) {
|
|
321
|
+
if ('logFn' in scriptOptions && scriptOptions.debug) {
|
|
322
322
|
const fetchEnd = performance.now();
|
|
323
323
|
timeBegin = performance.now();
|
|
324
324
|
scriptOptions.logFn(`MarkdownUp: Fetch completed in ${(fetchEnd - fetchBegin).toFixed(1)} milliseconds`);
|
|
@@ -383,7 +383,7 @@ export class MarkdownUp {
|
|
|
383
383
|
scriptOptions.runtime.reset();
|
|
384
384
|
|
|
385
385
|
// Log Markdown render end
|
|
386
|
-
if ('logFn' in scriptOptions) {
|
|
386
|
+
if ('logFn' in scriptOptions && scriptOptions.debug) {
|
|
387
387
|
const timeEnd = performance.now();
|
|
388
388
|
scriptOptions.logFn(`MarkdownUp: Markdown rendered in ${(timeEnd - timeBegin).toFixed(1)} milliseconds`);
|
|
389
389
|
}
|
|
@@ -416,7 +416,7 @@ export class MarkdownUp {
|
|
|
416
416
|
try {
|
|
417
417
|
scriptOptions.variables[varName] = evaluateExpression(parseExpression(varExprStr), scriptOptions.variables);
|
|
418
418
|
} catch ({message}) {
|
|
419
|
-
if (logFn !== null) {
|
|
419
|
+
if (logFn !== null && scriptOptions.debug) {
|
|
420
420
|
logFn(`MarkdownUp: Error evaluating variable "${varName}" expression "${varExprStr}": ${message}`);
|
|
421
421
|
}
|
|
422
422
|
}
|
package/lib/script.js
CHANGED
|
@@ -51,7 +51,7 @@ export async function markdownScriptCodeBlock(codeBlock, options) {
|
|
|
51
51
|
|
|
52
52
|
// Log script execution begin
|
|
53
53
|
let timeBegin;
|
|
54
|
-
if ('logFn' in options) {
|
|
54
|
+
if ('logFn' in options && options.debug) {
|
|
55
55
|
timeBegin = performance.now();
|
|
56
56
|
options.logFn(`MarkdownUp: Executing script at line number ${codeBlock.startLineNumber + 1} ...`);
|
|
57
57
|
}
|
|
@@ -63,7 +63,7 @@ export async function markdownScriptCodeBlock(codeBlock, options) {
|
|
|
63
63
|
const script = parseScript(codeBlock.lines, codeBlock.startLineNumber + 1);
|
|
64
64
|
|
|
65
65
|
// Run the calc-script linter?
|
|
66
|
-
if ('logFn' in options) {
|
|
66
|
+
if ('logFn' in options && options.debug) {
|
|
67
67
|
const warnings = lintScript(script);
|
|
68
68
|
const warningPrefix = `MarkdownUp: Script static analysis...`;
|
|
69
69
|
if (warnings.length === 0) {
|
|
@@ -83,7 +83,7 @@ export async function markdownScriptCodeBlock(codeBlock, options) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
// Log script execution end with timing
|
|
86
|
-
if ('logFn' in options) {
|
|
86
|
+
if ('logFn' in options && options.debug) {
|
|
87
87
|
const timeEnd = performance.now();
|
|
88
88
|
options.logFn(`MarkdownUp: Script executed in ${(timeEnd - timeBegin).toFixed(1)} milliseconds`);
|
|
89
89
|
}
|
package/lib/scriptLibrary.js
CHANGED
|
@@ -366,7 +366,7 @@ export const markdownScriptFunctions = {
|
|
|
366
366
|
try {
|
|
367
367
|
await callback([event.clientX - boundingRect.left, event.clientY - boundingRect.top], options);
|
|
368
368
|
} catch ({message}) {
|
|
369
|
-
if ('logFn' in options) {
|
|
369
|
+
if ('logFn' in options && options.debug) {
|
|
370
370
|
options.logFn(`MarkdownUp: Error executing drawOnClick callback: ${message}`);
|
|
371
371
|
}
|
|
372
372
|
}
|
|
@@ -704,7 +704,7 @@ export const markdownScriptFunctions = {
|
|
|
704
704
|
try {
|
|
705
705
|
await callback([], options);
|
|
706
706
|
} catch ({message}) {
|
|
707
|
-
if ('logFn' in options) {
|
|
707
|
+
if ('logFn' in options && options.debug) {
|
|
708
708
|
options.logFn(`MarkdownUp: Error executing windowSetResize callback: ${message}`);
|
|
709
709
|
}
|
|
710
710
|
}
|
|
@@ -725,7 +725,7 @@ export const markdownScriptFunctions = {
|
|
|
725
725
|
try {
|
|
726
726
|
await callback([], options);
|
|
727
727
|
} catch ({message}) {
|
|
728
|
-
if ('logFn' in options) {
|
|
728
|
+
if ('logFn' in options && options.debug) {
|
|
729
729
|
options.logFn(`MarkdownUp: Error executing windowSetTimeout callback: ${message}`);
|
|
730
730
|
}
|
|
731
731
|
}
|
|
@@ -792,7 +792,7 @@ function elementModelWrapCallbacks(elements, options) {
|
|
|
792
792
|
try {
|
|
793
793
|
await elementEventCallback(eventArgs, options);
|
|
794
794
|
} catch ({message}) {
|
|
795
|
-
if ('logFn' in options) {
|
|
795
|
+
if ('logFn' in options && options.debug) {
|
|
796
796
|
options.logFn(`MarkdownUp: Error executing elementModelRender callback: ${message}`);
|
|
797
797
|
}
|
|
798
798
|
}
|