markdown-up 2.3.1 → 2.3.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/README.md +4 -2
- package/lib/app.js +5 -6
- package/lib/scriptLibrary.js +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -113,13 +113,15 @@ Click here to [see the example in action](https://craigahobbs.github.io/markdown
|
|
|
113
113
|
### The MarkdownUp Include Library
|
|
114
114
|
|
|
115
115
|
MarkdownUp provides some additional functionality that can be included at runtime. Consider the
|
|
116
|
-
following example
|
|
116
|
+
following example that uses the
|
|
117
|
+
[unittest.mds](https://craigahobbs.github.io/markdown-up/library/include.html#var.vGroup='unittest.mds')
|
|
118
|
+
system library:
|
|
117
119
|
|
|
118
120
|
~~~
|
|
119
121
|
include <unittest.mds>
|
|
120
122
|
|
|
121
123
|
function testSanity():
|
|
122
|
-
|
|
124
|
+
unittestEqual(1 + 1, 2)
|
|
123
125
|
endfunction
|
|
124
126
|
unittestRunTest('testSanity')
|
|
125
127
|
|
package/lib/app.js
CHANGED
|
@@ -194,10 +194,13 @@ export class MarkdownUp {
|
|
|
194
194
|
return;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
// If there is a URL hash ID, re-navigate to go there since it was just rendered.
|
|
198
|
-
//
|
|
197
|
+
// If there is a URL hash ID, re-navigate to go there since it was just rendered.
|
|
198
|
+
// The re-render is short-circuited by the unchanged hash param check above.
|
|
199
199
|
if (!isError && getHashID(this.window.location.hash) !== null) {
|
|
200
200
|
this.window.location.href = this.window.location.hash;
|
|
201
|
+
} else {
|
|
202
|
+
// Otherwise, scroll to the top of the page
|
|
203
|
+
this.window.scrollTo(0, 0);
|
|
201
204
|
}
|
|
202
205
|
}
|
|
203
206
|
|
|
@@ -347,10 +350,6 @@ export class MarkdownUp {
|
|
|
347
350
|
// Menu "burger"
|
|
348
351
|
this.burgerElements(),
|
|
349
352
|
|
|
350
|
-
// Add a top hash ID, if necessary
|
|
351
|
-
Object.keys(this.params).length === 0
|
|
352
|
-
? null : {'html': 'div', 'attr': {'id': encodeQueryString(this.params), 'style': 'display=none'}},
|
|
353
|
-
|
|
354
353
|
// Render the markdown
|
|
355
354
|
await markdownElementsAsync(markdownModel, {
|
|
356
355
|
'codeBlocks': {
|
package/lib/scriptLibrary.js
CHANGED
|
@@ -479,6 +479,12 @@ export const markdownScriptFunctions = {
|
|
|
479
479
|
// $return: The local storage value string or null if the key does not exist
|
|
480
480
|
'localStorageGet': ([key], options) => options.window.localStorage.getItem(key),
|
|
481
481
|
|
|
482
|
+
// $function: localStorageRemove
|
|
483
|
+
// $group: Local Storage
|
|
484
|
+
// $doc: Remove a browser local storage key
|
|
485
|
+
// $arg key: The key string
|
|
486
|
+
'localStorageRemove': ([key], options) => options.window.localStorage.removeItem(key),
|
|
487
|
+
|
|
482
488
|
// $function: localStorageSet
|
|
483
489
|
// $group: Local Storage
|
|
484
490
|
// $doc: Set a browser local storage key's value
|
|
@@ -486,12 +492,6 @@ export const markdownScriptFunctions = {
|
|
|
486
492
|
// $arg value: The value string
|
|
487
493
|
'localStorageSet': ([key, value], options) => options.window.localStorage.setItem(key, value),
|
|
488
494
|
|
|
489
|
-
// $function: localStorageRemove
|
|
490
|
-
// $group: Local Storage
|
|
491
|
-
// $doc: Remove a browser local storage key
|
|
492
|
-
// $arg key: The key string
|
|
493
|
-
'localStorageRemove': ([key], options) => options.window.localStorage.removeItem(key),
|
|
494
|
-
|
|
495
495
|
|
|
496
496
|
//
|
|
497
497
|
// Markdown functions
|