markdown-up 5.0.0 → 5.1.0
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 +2 -3
- package/lib/appImports.js +0 -3
- package/lib/script.js +3 -4
- package/package.json +6 -6
package/lib/app.js
CHANGED
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
/** @module lib/app */
|
|
5
5
|
|
|
6
6
|
import {MarkdownScriptRuntime, markdownScriptCodeBlock} from './script.js';
|
|
7
|
+
import {barescriptParseExpression, evaluateExpression} from 'bare-script/lib/runtime.js';
|
|
7
8
|
import {elementModelWrapCallbacks, markdownScriptFunctions} from './scriptLibrary.js';
|
|
8
9
|
import {markdownElementsAsync, markdownParse, markdownTitle, schemaParse, schemaValidate} from 'bare-script/lib/include.js';
|
|
9
10
|
// eslint-disable-next-line no-duplicate-imports
|
|
10
11
|
import {urlDecodeQueryString, urlEncodeQueryString} from 'bare-script/lib/include.js';
|
|
11
|
-
import {evaluateExpression} from 'bare-script/lib/runtime.js';
|
|
12
|
-
import {parseExpression} from 'bare-script/lib/parser.js';
|
|
13
12
|
import {renderElements} from 'element-model/lib/elementModel.js';
|
|
14
13
|
import {valueJSON} from 'bare-script/lib/value.js';
|
|
15
14
|
|
|
@@ -503,7 +502,7 @@ export class MarkdownUp {
|
|
|
503
502
|
for (const varName of Object.keys(this.params.var)) {
|
|
504
503
|
const varExprStr = this.params.var[varName];
|
|
505
504
|
try {
|
|
506
|
-
scriptOptions.variables[varName] = evaluateExpression(
|
|
505
|
+
scriptOptions.variables[varName] = evaluateExpression(barescriptParseExpression(varExprStr), scriptOptions.variables);
|
|
507
506
|
} catch ({message}) {
|
|
508
507
|
if (scriptOptions.debug) {
|
|
509
508
|
logFn(`MarkdownUp: Error evaluating variable "${varName}" expression "${varExprStr}": ${message}`);
|
package/lib/appImports.js
CHANGED
|
@@ -8,10 +8,7 @@
|
|
|
8
8
|
import 'bare-script/lib/include.js';
|
|
9
9
|
import 'bare-script/lib/includeSource.js';
|
|
10
10
|
import 'bare-script/lib/library.js';
|
|
11
|
-
import 'bare-script/lib/lint.js';
|
|
12
|
-
import 'bare-script/lib/model.js';
|
|
13
11
|
import 'bare-script/lib/options.js';
|
|
14
|
-
import 'bare-script/lib/parser.js';
|
|
15
12
|
import 'bare-script/lib/runtime.js';
|
|
16
13
|
import 'bare-script/lib/runtimeAsync.js';
|
|
17
14
|
import 'bare-script/lib/value.js';
|
package/lib/script.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
// Licensed under the MIT License
|
|
2
2
|
// https://github.com/craigahobbs/markdown-up/blob/main/LICENSE
|
|
3
3
|
|
|
4
|
+
import {barescriptLintScript, barescriptParseScript} from 'bare-script/lib/runtime.js';
|
|
4
5
|
import {markdownElements, markdownParse} from 'bare-script/lib/include.js';
|
|
5
6
|
import {elementModelWrapCallbacks} from './scriptLibrary.js';
|
|
6
7
|
import {executeScriptAsync} from 'bare-script/lib/runtimeAsync.js';
|
|
7
|
-
import {lintScript} from 'bare-script/lib/lint.js';
|
|
8
|
-
import {parseScript} from 'bare-script/lib/parser.js';
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -59,14 +58,14 @@ export async function markdownScriptCodeBlock(codeBlock, options) {
|
|
|
59
58
|
let errorMessage = null;
|
|
60
59
|
try {
|
|
61
60
|
// Parse the script
|
|
62
|
-
const script =
|
|
61
|
+
const script = barescriptParseScript(codeBlock.lines, codeBlock.startLineNumber + 1);
|
|
63
62
|
|
|
64
63
|
// Execute the script
|
|
65
64
|
await executeScriptAsync(script, options);
|
|
66
65
|
|
|
67
66
|
// Run the bare-script linter?
|
|
68
67
|
if ('logFn' in options && options.debug) {
|
|
69
|
-
const warnings =
|
|
68
|
+
const warnings = barescriptLintScript(script, options.globals);
|
|
70
69
|
const warningPrefix = `MarkdownUp: Script static analysis...`;
|
|
71
70
|
if (warnings.length === 0) {
|
|
72
71
|
options.logFn(`${warningPrefix} OK`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "markdown-up",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.1.0",
|
|
5
5
|
"description": "MarkdownUp is a Markdown viewer",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"markdown",
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
"test": "node --test test/"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"bare-script": "~5.
|
|
25
|
+
"bare-script": "~5.1",
|
|
26
26
|
"element-model": "~1.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@eslint/js": "~10.0",
|
|
30
|
-
"c8": "~
|
|
31
|
-
"eslint": "~10.
|
|
32
|
-
"globals": "~17.
|
|
30
|
+
"c8": "~12.0",
|
|
31
|
+
"eslint": "~10.8",
|
|
32
|
+
"globals": "~17.8",
|
|
33
33
|
"jsdoc": "~4.0",
|
|
34
|
-
"jsdom": "~
|
|
34
|
+
"jsdom": "~30.0"
|
|
35
35
|
}
|
|
36
36
|
}
|