markdown-up 2.3.2 → 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.
Files changed (2) hide show
  1. package/lib/app.js +6 -7
  2. package/package.json +1 -1
package/lib/app.js CHANGED
@@ -194,10 +194,13 @@ export class MarkdownUp {
194
194
  return;
195
195
  }
196
196
 
197
- // If the window location hash exists in the document, re-navigate there since it was just rendered.
198
- // After the first render, re-render is short-circuited by the unchanged hash param check above.
199
- if (!isError && this.window.document.getElementById(this.window.location.hash.slice(1)) !== null) {
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
+ 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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "markdown-up",
4
- "version": "2.3.2",
4
+ "version": "2.3.3",
5
5
  "description": "MarkdownUp is a Markdown viewer",
6
6
  "keywords": [
7
7
  "markdown",