markdown-up 1.8.5 → 1.8.6
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 +5 -0
- package/package.json +1 -1
package/lib/app.js
CHANGED
|
@@ -77,6 +77,7 @@ enum MarkdownUpView
|
|
|
77
77
|
* @typedef {Object} MarkdownUpOptions
|
|
78
78
|
* @property {boolean} [darkMode = false] - If true, use dark mode by default
|
|
79
79
|
* @property {number} [fontSize = 12] - The font size, in points
|
|
80
|
+
* @property {?Object} [globals = null] - Global script runtime variables
|
|
80
81
|
* @property {number} [lineHeight = 1.2] - The line height, in em
|
|
81
82
|
* @property {?string} [markdownText = null] - The default Markdown text
|
|
82
83
|
* @property {boolean} [menu = true] - If true, show the menu
|
|
@@ -101,6 +102,7 @@ export class MarkdownUp {
|
|
|
101
102
|
this.paramsSession = null;
|
|
102
103
|
this.darkMode = (options !== null ? options.darkMode : null) ?? false;
|
|
103
104
|
this.fontSize = (options !== null ? options.fontSize : null) ?? 12;
|
|
105
|
+
this.globals = (options !== null ? options.globals : null) ?? null;
|
|
104
106
|
this.lineHeight = (options !== null ? options.lineHeight : null) ?? 1.2;
|
|
105
107
|
this.markdownText = (options !== null ? options.markdownText : null) ?? null;
|
|
106
108
|
this.menu = (options !== null ? options.menu : null) ?? true;
|
|
@@ -393,6 +395,9 @@ export class MarkdownUp {
|
|
|
393
395
|
// Create the markdown-script runtime
|
|
394
396
|
const runtime = new MarkdownScriptRuntime(scriptOptions);
|
|
395
397
|
scriptOptions.globals = {...markdownScriptFunctions};
|
|
398
|
+
if (this.globals !== null) {
|
|
399
|
+
Object.assign(scriptOptions.globals, this.globals);
|
|
400
|
+
}
|
|
396
401
|
scriptOptions.runtime = runtime;
|
|
397
402
|
scriptOptions.runtimeUpdateFn = () => {
|
|
398
403
|
// Did script set the document title?
|