markdown-up 2.0.1 → 2.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/README.md +6 -6
- package/lib/app.js +2 -2
- package/lib/data.js +5 -5
- package/lib/script.js +5 -5
- package/lib/scriptLibrary.js +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ To view a different Markdown resource, set the application's
|
|
|
62
62
|
Using MarkdownUp's "markdown-script" fenced code blocks, you can dynamically generate Markdown,
|
|
63
63
|
allowing you to build lightweight, client-rendered web applications with no HTML, no CSS, and a
|
|
64
64
|
single dependency (MarkdownUp). The "markdown-script" fenced code blocks are interpreted as the
|
|
65
|
-
[
|
|
65
|
+
[BareScript programming language](https://craigahobbs.github.io/bare-script/language/).
|
|
66
66
|
In addition to generating Markdown, you can fetch text and JSON resources, create SVG drawings,
|
|
67
67
|
parse CSV, render data tables, draw line charts, and more. For more information, see the
|
|
68
68
|
[MarkdownUp Library](https://craigahobbs.github.io/markdown-up/library/).
|
|
@@ -133,15 +133,15 @@ documentation for more information on the available include libraries.
|
|
|
133
133
|
|
|
134
134
|
### Debug Mode
|
|
135
135
|
|
|
136
|
-
Debug mode logs the script runtime duration and runs the
|
|
136
|
+
Debug mode logs the script runtime duration and runs the BareScript linter, which performs static
|
|
137
137
|
code analysis on your code and reports warnings for any issues found.
|
|
138
138
|
|
|
139
139
|
Debug mode also enables debug logging using the
|
|
140
|
-
[
|
|
140
|
+
[systemLogDebug function](https://craigahobbs.github.io/bare-script/library/#var.vName='systemLogDebug').
|
|
141
141
|
For example:
|
|
142
142
|
|
|
143
|
-
~~~
|
|
144
|
-
|
|
143
|
+
~~~ barescript
|
|
144
|
+
systemLogDebug('Hello debug')
|
|
145
145
|
~~~
|
|
146
146
|
|
|
147
147
|
To turn on debug mode, click the debug button in the MarkdownUp menu in the upper-right of the page.
|
|
@@ -150,7 +150,7 @@ To turn on debug mode, click the debug button in the MarkdownUp menu in the uppe
|
|
|
150
150
|
### Links
|
|
151
151
|
|
|
152
152
|
- [MarkdownUp Application Examples](https://craigahobbs.github.io/#url=MarkdownUpApplications.md)
|
|
153
|
-
- [The
|
|
153
|
+
- [The BareScript Language](https://craigahobbs.github.io/bare-script/language/)
|
|
154
154
|
- [The MarkdownUp Library](https://craigahobbs.github.io/markdown-up/library/)
|
|
155
155
|
- [The MarkdownUp Include Library](https://craigahobbs.github.io/markdown-up/library/include.html)
|
|
156
156
|
|
package/lib/app.js
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
import {MarkdownScriptRuntime, markdownScriptCodeBlock} from './script.js';
|
|
7
7
|
import {decodeQueryString, encodeQueryString, jsonStringifySortKeys} from 'schema-markdown/lib/encode.js';
|
|
8
8
|
import {getMarkdownTitle, parseMarkdown} from 'markdown-model/lib/parser.js';
|
|
9
|
-
import {evaluateExpression} from '
|
|
9
|
+
import {evaluateExpression} from 'bare-script/lib/runtime.js';
|
|
10
10
|
import {markdownElementsAsync} from 'markdown-model/lib/elements.js';
|
|
11
11
|
import {markdownScriptFunctions} from './scriptLibrary.js';
|
|
12
|
-
import {parseExpression} from '
|
|
12
|
+
import {parseExpression} from 'bare-script/lib/parser.js';
|
|
13
13
|
import {parseSchemaMarkdown} from 'schema-markdown/lib/parser.js';
|
|
14
14
|
import {renderElements} from 'element-model/lib/elementModel.js';
|
|
15
15
|
import {schemaMarkdownDoc} from 'schema-markdown-doc/lib/schemaMarkdownDoc.js';
|
package/lib/data.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
/** @module lib/data */
|
|
5
5
|
|
|
6
|
-
import {evaluateExpression} from '
|
|
6
|
+
import {evaluateExpression} from 'bare-script/lib/runtime.js';
|
|
7
7
|
import {jsonStringifySortKeys} from 'schema-markdown/lib/encode.js';
|
|
8
|
-
import {parseExpression} from '
|
|
8
|
+
import {parseExpression} from 'bare-script/lib/parser.js';
|
|
9
9
|
import {parseSchemaMarkdown} from 'schema-markdown/lib/parser.js';
|
|
10
10
|
import {validateType} from 'schema-markdown/lib/schema.js';
|
|
11
11
|
|
|
@@ -178,8 +178,8 @@ const rDatetime = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?(?:Z|[+-]\d{2
|
|
|
178
178
|
*
|
|
179
179
|
* @param {Object} leftData - The left data array
|
|
180
180
|
* @param {Object} rightData - The left data array
|
|
181
|
-
* @param {string} joinExpr - The join [expression]{@link https://craigahobbs.github.io/
|
|
182
|
-
* @param {?string} [rightExpr = null] - The right join [expression]{@link https://craigahobbs.github.io/
|
|
181
|
+
* @param {string} joinExpr - The join [expression]{@link https://craigahobbs.github.io/bare-script/language/#expressions}
|
|
182
|
+
* @param {?string} [rightExpr = null] - The right join [expression]{@link https://craigahobbs.github.io/bare-script/language/#expressions}
|
|
183
183
|
* @param {boolean} [isLeftJoin = false] - If true, perform a left join (always include left row)
|
|
184
184
|
* @param {?Object} [variables = null] - Additional variables for expression evaluation
|
|
185
185
|
* @param {?Object} [options = null] - The [markdown-script options]{@link module:lib/script~MarkdownScriptOptions}
|
|
@@ -297,7 +297,7 @@ export function addCalculatedField(data, fieldName, expr, variables = null, opti
|
|
|
297
297
|
* Filter data rows
|
|
298
298
|
*
|
|
299
299
|
* @param {Object[]} data - The data array
|
|
300
|
-
* @param {string} expr - The boolean filter [expression]{@link https://craigahobbs.github.io/
|
|
300
|
+
* @param {string} expr - The boolean filter [expression]{@link https://craigahobbs.github.io/bare-script/language/#expressions}
|
|
301
301
|
* @param {?Object} [variables = null] - Additional variables for expression evaluation
|
|
302
302
|
* @param {?Object} [options = null] - The [markdown-script options]{@link module:lib/script~MarkdownScriptOptions}
|
|
303
303
|
* @returns {Object[]} The filtered data array
|
package/lib/script.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// Licensed under the MIT License
|
|
2
2
|
// https://github.com/craigahobbs/markdown-up/blob/main/LICENSE
|
|
3
3
|
|
|
4
|
-
import {executeScriptAsync} from '
|
|
5
|
-
import {lintScript} from '
|
|
4
|
+
import {executeScriptAsync} from 'bare-script/lib/runtimeAsync.js';
|
|
5
|
+
import {lintScript} from 'bare-script/lib/model.js';
|
|
6
6
|
import {markdownElements} from 'markdown-model/lib/elements.js';
|
|
7
7
|
import {parseMarkdown} from 'markdown-model/lib/parser.js';
|
|
8
|
-
import {parseScript} from '
|
|
8
|
+
import {parseScript} from 'bare-script/lib/parser.js';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* The markdown-script code block function options (based on
|
|
13
|
-
* [
|
|
13
|
+
* [bare-script's options]{@link https://craigahobbs.github.io/bare-script/module-lib_runtime.html#~ExecuteScriptOptions}).
|
|
14
14
|
*
|
|
15
15
|
* @typedef {Object} MarkdownScriptOptions
|
|
16
16
|
* @property {number} fontSize - The font size, in points
|
|
@@ -62,7 +62,7 @@ export async function markdownScriptCodeBlock(codeBlock, options) {
|
|
|
62
62
|
// Parse the script
|
|
63
63
|
const script = parseScript(codeBlock.lines, codeBlock.startLineNumber + 1);
|
|
64
64
|
|
|
65
|
-
// Run the
|
|
65
|
+
// Run the bare-script linter?
|
|
66
66
|
if ('logFn' in options && options.debug) {
|
|
67
67
|
const warnings = lintScript(script);
|
|
68
68
|
const warningPrefix = `MarkdownUp: Script static analysis...`;
|
package/lib/scriptLibrary.js
CHANGED
|
@@ -63,9 +63,9 @@ export const markdownScriptFunctions = {
|
|
|
63
63
|
// $doc: Join two data arrays
|
|
64
64
|
// $arg leftData: The left data array
|
|
65
65
|
// $arg rightData: The right data array
|
|
66
|
-
// $arg joinExpr: The [join expression](https://craigahobbs.github.io/
|
|
66
|
+
// $arg joinExpr: The [join expression](https://craigahobbs.github.io/bare-script/language/#expressions)
|
|
67
67
|
// $arg rightExpr: Optional (default is null).
|
|
68
|
-
// $arg rightExpr: The right [join expression](https://craigahobbs.github.io/
|
|
68
|
+
// $arg rightExpr: The right [join expression](https://craigahobbs.github.io/bare-script/language/#expressions)
|
|
69
69
|
// $arg isLeftJoin: Optional (default is false). If true, perform a left join (always include left row).
|
|
70
70
|
// $arg variables: Optional (default is null). A variables object for join expression evaluation.
|
|
71
71
|
// $return: The joined data array
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "markdown-up",
|
|
4
|
-
"version": "2.0
|
|
4
|
+
"version": "2.1.0",
|
|
5
5
|
"description": "MarkdownUp is a Markdown viewer",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"markdown",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test": "node --test test/"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"
|
|
25
|
+
"bare-script": "~2.1",
|
|
26
26
|
"element-model": "~1.1",
|
|
27
27
|
"markdown-model": "~1.8",
|
|
28
28
|
"schema-markdown": "~1.2",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"c8": "~8.0",
|
|
33
|
-
"eslint": "~8.
|
|
33
|
+
"eslint": "~8.48",
|
|
34
34
|
"jsdoc": "~4.0",
|
|
35
35
|
"jsdom": "~22.1"
|
|
36
36
|
}
|