markdown-up 1.7.0 → 1.7.3

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/util.js CHANGED
@@ -14,30 +14,26 @@ import {renderElements} from 'element-model/lib/elementModel.js';
14
14
  * [calc-script's options]{@link https://craigahobbs.github.io/calc-script/module-lib_runtime.html#~ExecuteScriptOptions}).
15
15
  *
16
16
  * @typedef {Object} MarkdownScriptOptions
17
- * @property {number} [fontSize] - The chart font size, in points
18
- * @property {Object} [localStorage] - The localStorage object
19
- * @property {module:lib/util~NavigateTimeoutFn} [navigateTimeoutFn] - The navigate timeout function
20
- * @property {Object} [params] - The hash parameters object
21
- * @property {module:lib/script.MarkdownScriptRuntime} [runtime] - The markdown-script runtime state
22
- * @property {Object} [sessionStorage] - The sessionStorage object
23
- * @property {module:lib/util~URLFn} [urlFn] - The URL modifier function
24
- * @property {Object} [variables] - The map of variable name to chart variable value
17
+ * @property {number} fontSize - The font size, in points
18
+ * @property {Object} params - The hash parameters object
19
+ * @property {Object} runtime - The [markdown-script runtime state]{@link module:lib/script.MarkdownScriptRuntime}
20
+ * @property {Object} [variables] - The map of variable name to variable value
21
+ * @property {Object} window - The web browser window object
22
+ * @property {function} runtimeUpdateFn - The [runtime update callback function]{@link module:lib/util~MarkdownScriptRuntimeUpdateFn}
25
23
  */
26
24
 
27
25
  /**
28
- * A URL modifier function
26
+ * A runtime update callback function
29
27
  *
30
- * @callback URLFn
31
- * @param {string} url - The URL
32
- * @returns {string} The modified URL
28
+ * @callback MarkdownScriptRuntimeUpdateFn
33
29
  */
34
30
 
35
31
  /**
36
- * A navigate timeout function
32
+ * A URL modifier function
37
33
  *
38
- * @callback NavigateTimeoutFn
39
- * @param {string} url - The URL to navigate to
40
- * @param {number} delay - The navigation delay, in milliseconds
34
+ * @callback URLFn
35
+ * @param {string} url - The URL
36
+ * @returns {string} The modified URL
41
37
  */
42
38
 
43
39
 
@@ -132,11 +128,11 @@ export function parameterValue(param, minValue, maxValue) {
132
128
 
133
129
 
134
130
  // Generic code block helper function
135
- export function chartCodeBlock(language, lines, options, validationFn, renderFn) {
131
+ export function chartCodeBlock(codeBlock, options, validationFn, renderFn) {
136
132
  // Decode and validate the chart model
137
- let chartModel;
133
+ let chart;
138
134
  try {
139
- chartModel = validationFn(decodeChartLines(lines));
135
+ chart = validationFn(decodeChartLines(codeBlock.lines));
140
136
  } catch ({message}) {
141
137
  return {'html': 'p', 'elem': {'html': 'pre', 'elem': {'text': `Error: ${message}`}}};
142
138
  }
@@ -144,15 +140,15 @@ export function chartCodeBlock(language, lines, options, validationFn, renderFn)
144
140
  // Render the chart asynchronously
145
141
  return {
146
142
  'html': 'p',
147
- 'elem': !('width' in chartModel) ? null : {
143
+ 'elem': !('width' in chart) ? null : {
148
144
  'svg': 'svg',
149
145
  'attr': {
150
- 'width': chartModel.width,
151
- 'height': chartModel.height
146
+ 'width': chart.width,
147
+ 'height': chart.height
152
148
  }
153
149
  },
154
150
  'callback': (parent) => {
155
- renderFn(chartModel, options).
151
+ renderFn(chart, options).
156
152
  then((elements) => {
157
153
  renderElements(parent, elements);
158
154
  }).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "markdown-up",
4
- "version": "1.7.0",
4
+ "version": "1.7.3",
5
5
  "description": "JavaScript Markdown viewer application",
6
6
  "keywords": [
7
7
  "markdown",
@@ -22,17 +22,17 @@
22
22
  "test": "ava -v test/"
23
23
  },
24
24
  "dependencies": {
25
- "calc-script": "~0.9",
26
- "element-app": "~1.1",
25
+ "calc-script": "~1.0",
26
+ "element-model": "~1.1",
27
27
  "markdown-model": "~1.4",
28
28
  "schema-markdown": "~1.1",
29
- "schema-markdown-doc": "~1.3"
29
+ "schema-markdown-doc": "~1.4"
30
30
  },
31
31
  "devDependencies": {
32
- "ava": "~4.2",
32
+ "ava": "~4.3",
33
33
  "c8": "~7.11",
34
- "eslint": "~8.14",
34
+ "eslint": "~8.19",
35
35
  "jsdoc": "~3.6",
36
- "jsdom": "~19.0"
36
+ "jsdom": "~20.0"
37
37
  }
38
38
  }