markdown-up 1.3.1 → 1.4.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/lib/app.js +17 -10
- package/package.json +5 -5
package/lib/app.js
CHANGED
|
@@ -4,8 +4,11 @@
|
|
|
4
4
|
/** @module lib/app */
|
|
5
5
|
|
|
6
6
|
import {ElementApplication, encodeHashID, getHashID} from 'element-app/lib/app.js';
|
|
7
|
-
import {decodeQueryString, encodeQueryString} from 'schema-markdown/
|
|
8
|
-
import {getBaseURL,
|
|
7
|
+
import {decodeQueryString, encodeQueryString} from 'schema-markdown/lib/encode.js';
|
|
8
|
+
import {getBaseURL, isRelativeURL, markdownElements} from 'markdown-model/lib/elements.js';
|
|
9
|
+
import {UserTypeElements} from 'schema-markdown-doc/lib/userTypeElements.js';
|
|
10
|
+
import {getMarkdownTitle} from 'markdown-model/lib/markdownModel.js';
|
|
11
|
+
import {parseMarkdown} from 'markdown-model/lib/parser.js';
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
// The application's hash parameter type model
|
|
@@ -48,10 +51,11 @@ union Command
|
|
|
48
51
|
|
|
49
52
|
|
|
50
53
|
/**
|
|
51
|
-
* MarkdownUp, a web application for viewing Markdown files
|
|
54
|
+
* MarkdownUp, a web application for viewing Markdown files
|
|
52
55
|
*
|
|
53
|
-
* MarkdownUp
|
|
54
|
-
* [
|
|
56
|
+
* The MarkdownUp class extends the element-app
|
|
57
|
+
* [ElementApplication]{@link https://craigahobbs.github.io/element-app/module-lib_app.ElementApplication.html}
|
|
58
|
+
* class.
|
|
55
59
|
*
|
|
56
60
|
* @extends ElementApplication
|
|
57
61
|
* @property {number} fontSize - The font size, in points
|
|
@@ -102,12 +106,19 @@ export class MarkdownUp extends ElementApplication {
|
|
|
102
106
|
|
|
103
107
|
/**
|
|
104
108
|
* The [Element Application main entry point]{@link
|
|
105
|
-
* https://craigahobbs.github.io/element-app/module-lib_app.ElementApplication.html#
|
|
109
|
+
* https://craigahobbs.github.io/element-app/module-lib_app.ElementApplication.html#main}.
|
|
106
110
|
*
|
|
107
111
|
* @override
|
|
108
112
|
* @returns {Object} [MainResult]{@link https://craigahobbs.github.io/element-app/module-lib_app.html#~MainResult}
|
|
109
113
|
*/
|
|
110
114
|
async main() {
|
|
115
|
+
// Help?
|
|
116
|
+
if ('cmd' in this.params && 'help' in this.params.cmd) {
|
|
117
|
+
return {
|
|
118
|
+
'elements': new UserTypeElements(this.params).getElements(this.hashTypes, this.hashType)
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
111
122
|
// Load the text resource
|
|
112
123
|
const url = 'url' in this.params ? this.params.url : this.url;
|
|
113
124
|
let text = null;
|
|
@@ -165,10 +176,6 @@ export class MarkdownUp extends ElementApplication {
|
|
|
165
176
|
return {
|
|
166
177
|
'title': markdownTitle,
|
|
167
178
|
'elements': [
|
|
168
|
-
// Application hash parameter help?
|
|
169
|
-
!('cmd' in this.params && 'help' in this.params.cmd)
|
|
170
|
-
? null : this.helpElements(),
|
|
171
|
-
|
|
172
179
|
// Render markdown?
|
|
173
180
|
!('cmd' in this.params && 'markdown' in this.params.cmd)
|
|
174
181
|
? null : {'html': 'div', 'attr': {'class': 'markdown'}, 'elem': {'text': text}},
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "markdown-up",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"description": "JavaScript Markdown viewer application",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"markdown",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"test": "ava -v test/"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"element-app": "~1.
|
|
26
|
-
"
|
|
27
|
-
"markdown
|
|
28
|
-
"schema-markdown": "~1.
|
|
25
|
+
"element-app": "~1.1",
|
|
26
|
+
"markdown-model": "~1.3",
|
|
27
|
+
"schema-markdown": "~1.1",
|
|
28
|
+
"schema-markdown-doc": "~1.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"ava": "^4.0.0-rc.1",
|