nodebb-plugin-markdown 12.0.5 → 12.1.1
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/index.js +4 -3
- package/lib/controllers.js +1 -0
- package/package.json +1 -1
- package/public/scss/default.scss +3 -1
- package/public/templates/admin/plugins/markdown.tpl +170 -169
package/index.js
CHANGED
|
@@ -26,17 +26,18 @@ const Markdown = {
|
|
|
26
26
|
_externalImageFailures: new Set(),
|
|
27
27
|
onLoad: async function (params) {
|
|
28
28
|
app = params.app;
|
|
29
|
+
const { router } = params;
|
|
29
30
|
const controllers = require('./lib/controllers');
|
|
30
31
|
const hostMiddleware = require.main.require('./src/middleware');
|
|
32
|
+
const routeHelpers = require.main.require('./src/routes/helpers');
|
|
31
33
|
const middlewares = [
|
|
32
34
|
hostMiddleware.maintenanceMode, hostMiddleware.registrationComplete, hostMiddleware.pluginHooks,
|
|
33
35
|
];
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
params.router.get('/api/admin/plugins/markdown', controllers.renderAdmin);
|
|
37
|
+
routeHelpers.setupAdminPageRoute(router, '/admin/plugins/markdown', controllers.renderAdmin);
|
|
37
38
|
|
|
38
39
|
// Return raw markdown via GET
|
|
39
|
-
|
|
40
|
+
router.get('/api/post/:pid/raw', middlewares, controllers.retrieveRaw);
|
|
40
41
|
|
|
41
42
|
Markdown.init();
|
|
42
43
|
await Markdown.loadThemes();
|
package/lib/controllers.js
CHANGED
package/package.json
CHANGED
package/public/scss/default.scss
CHANGED
|
@@ -1,191 +1,192 @@
|
|
|
1
|
-
<div class="
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<div class="card
|
|
8
|
-
<div class="
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
1
|
+
<div class="acp-page-container">
|
|
2
|
+
<!-- IMPORT admin/partials/settings/header.tpl -->
|
|
3
|
+
|
|
4
|
+
<div class="row m-0">
|
|
5
|
+
<div id="spy-container" class="col-12 px-0 mb-4" tabindex="0">
|
|
6
|
+
<form class="form markdown-settings">
|
|
7
|
+
<div class="card">
|
|
8
|
+
<div class="card-header">Markdown</div>
|
|
9
|
+
<div class="card-body">
|
|
10
|
+
<div class="row">
|
|
11
|
+
<div class="col-lg-6">
|
|
12
|
+
<div class="mb-3 form-check">
|
|
13
|
+
<input type="checkbox" class="form-check-input" name="xhtmlOut" id="xhtmlOut" />
|
|
14
|
+
<label class="form-check-label" for="xhtmlOut">
|
|
15
|
+
Use '/' to close single tags (<code><br /></code>)
|
|
16
|
+
</label>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="mb-3 form-check">
|
|
19
|
+
<input type="checkbox" class="form-check-input" name="breaks" id="breaks" />
|
|
20
|
+
<label class="form-check-label" for="breaks">
|
|
21
|
+
Treat newlines as single line breaks
|
|
22
|
+
</label>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="mb-3 form-check">
|
|
25
|
+
<input type="checkbox" class="form-check-input" name="typographer" id="typographer" />
|
|
26
|
+
<label class="form-check-label" for="typographer">
|
|
27
|
+
Enable smartypants and other sweet transforms (e.g. <code>(c)</code> → <code>©</code>)
|
|
28
|
+
</label>
|
|
29
|
+
</div>
|
|
30
|
+
<div class="mb-3 form-check">
|
|
31
|
+
<input type="checkbox" class="form-check-input" name="multimdTables" id="multimdTables" />
|
|
32
|
+
<label class="form-check-label" for="multimdTables">
|
|
33
|
+
Allow advanced table syntax
|
|
34
|
+
</label>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="col-lg-6">
|
|
38
|
+
<div class="mb-3 form-check">
|
|
39
|
+
<input type="checkbox" class="form-check-input" name="linkify" id="linkify" />
|
|
40
|
+
<label class="form-check-label" for="linkify">
|
|
41
|
+
Autoconvert url-like texts to links
|
|
42
|
+
</label>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="mb-3 form-check">
|
|
45
|
+
<input type="checkbox" class="form-check-input" name="externalBlank" id="externalBlank" />
|
|
46
|
+
<label class="form-check-label" for="externalBlank">
|
|
47
|
+
Open external links in a new tab/window
|
|
48
|
+
</label>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="mb-3 form-check">
|
|
51
|
+
<input type="checkbox" class="form-check-input" name="nofollow" id="nofollow" />
|
|
52
|
+
<label class="form-check-label" for="nofollow">
|
|
53
|
+
Tell web crawlers that external links are not to be followed
|
|
54
|
+
</label>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="mb-3 form-check">
|
|
57
|
+
<input type="checkbox" class="form-check-input" name="allowRTLO" id="allowRTLO" />
|
|
58
|
+
<label class="form-check-label" for="allowRTLO">
|
|
59
|
+
Allow RTL override unicode in link content
|
|
60
|
+
</label>
|
|
61
|
+
</div>
|
|
62
|
+
<div class="mb-3 form-check">
|
|
63
|
+
<input type="checkbox" class="form-check-input" name="checkboxes" id="checkboxes" />
|
|
64
|
+
<label class="form-check-label" for="checkboxes">
|
|
65
|
+
Interpret <code>[ ]</code> and <code>[x]</code> as checkboxes
|
|
66
|
+
</label>
|
|
67
|
+
</div>
|
|
65
68
|
</div>
|
|
66
69
|
</div>
|
|
67
70
|
</div>
|
|
68
71
|
</div>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
</
|
|
80
|
-
</div>
|
|
72
|
+
<div class="row">
|
|
73
|
+
<div class="col-sm-6">
|
|
74
|
+
<div class="card">
|
|
75
|
+
<div class="card-header">Code Formatting</div>
|
|
76
|
+
<div class="card-body">
|
|
77
|
+
<div class="mb-3 form-check">
|
|
78
|
+
<input type="checkbox" class="form-check-input" name="highlight" id="highlight" />
|
|
79
|
+
<label class="form-check-label" for="highlight">
|
|
80
|
+
Automatically detect and highlight code blocks
|
|
81
|
+
</label>
|
|
82
|
+
</div>
|
|
81
83
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
<div class="mb-3">
|
|
85
|
+
<label class="form-label" for="highlightTheme">Use this theme for highlighted code blocks</label>
|
|
86
|
+
<select class="form-select" name="highlightTheme" id="highlightTheme">
|
|
87
|
+
{{{ each themes }}}
|
|
88
|
+
<option value="{@value}">{@value}</option>
|
|
89
|
+
{{{ end }}}
|
|
90
|
+
</select>
|
|
91
|
+
</div>
|
|
90
92
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
<div class="mb-3">
|
|
94
|
+
<label class="form-label" for="defaultHighlightLanguage">
|
|
95
|
+
Default language for code blocks with no language defined
|
|
96
|
+
</label>
|
|
97
|
+
<input class="form-control" placeholder="e.g. js" type="text" name="defaultHighlightLanguage" id="defaultHighlightLanguage" />
|
|
98
|
+
<p class="form-text">Leave blank to use auto-language detection</p>
|
|
99
|
+
</div>
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
<div class="mb-3">
|
|
102
|
+
<label class="form-label" for="langPrefix">
|
|
103
|
+
Prefix for <code>code</code> blocks
|
|
104
|
+
</label>
|
|
105
|
+
<input class="form-control" placeholder="language-" type="text" name="langPrefix" id="langPrefix" />
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<div class="mb-3">
|
|
109
|
+
<label class="form-label" for="hljsLanguages">Apply syntax highlighting to the following languages</label>
|
|
110
|
+
<select class="form-select" multiple="true" name="hljsLanguages" id="hljsLanguages" size="20">
|
|
111
|
+
<optgroup label="Pre-defined lists">
|
|
112
|
+
<option value="all">All supported languages (greatest file size)</option>
|
|
113
|
+
<option value="common" selected>Common languages (a good compromise)</option>
|
|
114
|
+
</optgroup>
|
|
115
|
+
<optgroup label="Individual languages">
|
|
116
|
+
{{{ each hljsLanguages }}}
|
|
117
|
+
<option value="{@value}">{@value}</option>
|
|
118
|
+
{{{ end }}}
|
|
119
|
+
</optgroup>
|
|
120
|
+
</select>
|
|
121
|
+
<p class="form-text">
|
|
122
|
+
You can use <code>ctrl</code> and <code>shift</code> to select/deselect multiple
|
|
123
|
+
items and select/deselect items in ranges. <em>(Default: "Common languages".)</em>
|
|
124
|
+
</p>
|
|
125
|
+
<p class="form-text">
|
|
126
|
+
You are able to mix and match any of the items above, although "All" will include
|
|
127
|
+
everything anyway.
|
|
128
|
+
</p>
|
|
129
|
+
</div>
|
|
105
130
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
<option value="common" selected>Common languages (a good compromise)</option>
|
|
112
|
-
</optgroup>
|
|
113
|
-
<optgroup label="Individual languages">
|
|
131
|
+
<div class="mb-3">
|
|
132
|
+
<label class="form-label" for="highlightLinesLanguageList">
|
|
133
|
+
Enable line numbers for the following languages
|
|
134
|
+
</label>
|
|
135
|
+
<select class="form-select" multiple="true" name="highlightLinesLanguageList" id="highlightLinesLanguageList" size="20">
|
|
114
136
|
{{{ each hljsLanguages }}}
|
|
115
137
|
<option value="{@value}">{@value}</option>
|
|
116
138
|
{{{ end }}}
|
|
117
|
-
</
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
</
|
|
123
|
-
<p class="form-text">
|
|
124
|
-
You are able to mix and match any of the items above, although "All" will include
|
|
125
|
-
everything anyway.
|
|
126
|
-
</p>
|
|
127
|
-
</div>
|
|
128
|
-
|
|
129
|
-
<div class="mb-3">
|
|
130
|
-
<label class="form-label" for="highlightLinesLanguageList">
|
|
131
|
-
Enable line numbers for the following languages
|
|
132
|
-
</label>
|
|
133
|
-
<select class="form-select" multiple="true" name="highlightLinesLanguageList" id="highlightLinesLanguageList" size="20">
|
|
134
|
-
{{{ each hljsLanguages }}}
|
|
135
|
-
<option value="{@value}">{@value}</option>
|
|
136
|
-
{{{ end }}}
|
|
137
|
-
</select>
|
|
138
|
-
<p class="form-text">
|
|
139
|
-
You can use <code>ctrl</code> and <code>shift</code> to select/deselect multiple
|
|
140
|
-
items and select/deselect items in ranges.
|
|
141
|
-
</p>
|
|
139
|
+
</select>
|
|
140
|
+
<p class="form-text">
|
|
141
|
+
You can use <code>ctrl</code> and <code>shift</code> to select/deselect multiple
|
|
142
|
+
items and select/deselect items in ranges.
|
|
143
|
+
</p>
|
|
144
|
+
</div>
|
|
142
145
|
</div>
|
|
143
146
|
</div>
|
|
144
147
|
</div>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
</
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
</
|
|
148
|
+
<div class="col-sm-6">
|
|
149
|
+
<div class="card">
|
|
150
|
+
<div class="card-header">Images</div>
|
|
151
|
+
<div class="card-body">
|
|
152
|
+
<div class="mb-3 form-check">
|
|
153
|
+
<input type="checkbox" class="form-check-input" name="probe" id="probe" />
|
|
154
|
+
<label class="form-check-label" for="probe">
|
|
155
|
+
Append image sizes for externally linked images
|
|
156
|
+
</label>
|
|
157
|
+
</div>
|
|
158
|
+
<div class="mb-3">
|
|
159
|
+
<label class="form-label" for="probeCacheSize">Cache size (number of images)</label>
|
|
160
|
+
<input class="form-control" type="number" id="probeCacheSize" name="probeCacheSize" placeholder="256 (Default)" />
|
|
161
|
+
<p class="form-text">
|
|
162
|
+
Markdown automatically saves image sizes so as to not make too many unnecessary calls. It remembers this value for 24 hours, to a maximum number of images as defined here. Increase this number if your forum posts contain links to many external images.
|
|
163
|
+
</p>
|
|
164
|
+
</div>
|
|
162
165
|
</div>
|
|
163
166
|
</div>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
</
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
</
|
|
167
|
+
<div class="card">
|
|
168
|
+
<div class="card-header bg-danger text-light">Danger Zone</div>
|
|
169
|
+
<div class="card-body">
|
|
170
|
+
<div class="mb-3 form-check">
|
|
171
|
+
<input type="checkbox" class="form-check-input" name="html" id="html" />
|
|
172
|
+
<label class="form-check-label" for="html">
|
|
173
|
+
Allow HTML
|
|
174
|
+
</label>
|
|
175
|
+
</div>
|
|
176
|
+
<div class="alert alert-warning">
|
|
177
|
+
<strong><i class="icon-warning-sign"></i> Careful!</strong>
|
|
178
|
+
<p>
|
|
179
|
+
Automatic HTML sanitization is an important part of ensuring that
|
|
180
|
+
your users do not run arbitrary javascript or alter parts of the
|
|
181
|
+
page that were not meant to be altered. If this option is checked,
|
|
182
|
+
beware the consequences!
|
|
183
|
+
</p>
|
|
184
|
+
</div>
|
|
182
185
|
</div>
|
|
183
186
|
</div>
|
|
184
187
|
</div>
|
|
185
188
|
</div>
|
|
186
|
-
</
|
|
187
|
-
</
|
|
189
|
+
</form>
|
|
190
|
+
</div>
|
|
188
191
|
</div>
|
|
189
192
|
</div>
|
|
190
|
-
|
|
191
|
-
<!-- IMPORT admin/partials/save_button.tpl -->
|