nodebb-plugin-markdown 12.0.5 → 12.1.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/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
- params.router.get('/admin/plugins/markdown', params.middleware.admin.buildHeader, controllers.renderAdmin);
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
- params.router.get('/api/post/:pid/raw', middlewares, controllers.retrieveRaw);
40
+ router.get('/api/post/:pid/raw', middlewares, controllers.retrieveRaw);
40
41
 
41
42
  Markdown.init();
42
43
  await Markdown.loadThemes();
@@ -14,6 +14,7 @@ Controllers.renderAdmin = async function renderAdmin(req, res) {
14
14
  res.render('admin/plugins/markdown', {
15
15
  themes: parent.themes,
16
16
  hljsLanguages,
17
+ title: 'Markdown',
17
18
  });
18
19
  };
19
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-markdown",
3
- "version": "12.0.5",
3
+ "version": "12.1.0",
4
4
  "description": "A Markdown parser for NodeBB",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -1,191 +1,192 @@
1
- <div class="row">
2
- <div class="col-sm-2 col-12 settings-header">General</div>
3
- <div class="col-sm-10 col-12">
4
- <form class="form markdown-settings">
5
- <div class="card">
6
- <div class="card-header">Markdown</div>
7
- <div class="card-body">
8
- <div class="row">
9
- <div class="col-lg-6">
10
- <div class="mb-3 form-check">
11
- <input type="checkbox" class="form-check-input" name="xhtmlOut" id="xhtmlOut" />
12
- <label class="form-check-label" for="xhtmlOut">
13
- Use '/' to close single tags (<code>&lt;br /&gt;</code>)
14
- </label>
15
- </div>
16
- <div class="mb-3 form-check">
17
- <input type="checkbox" class="form-check-input" name="breaks" id="breaks" />
18
- <label class="form-check-label" for="breaks">
19
- Treat newlines as single line breaks
20
- </label>
21
- </div>
22
- <div class="mb-3 form-check">
23
- <input type="checkbox" class="form-check-input" name="typographer" id="typographer" />
24
- <label class="form-check-label" for="typographer">
25
- Enable smartypants and other sweet transforms (e.g. <code>(c)</code> &rarr; <code>&copy;</code>)
26
- </label>
27
- </div>
28
- <div class="mb-3 form-check">
29
- <input type="checkbox" class="form-check-input" name="multimdTables" id="multimdTables" />
30
- <label class="form-check-label" for="multimdTables">
31
- Allow advanced table syntax
32
- </label>
33
- </div>
34
- </div>
35
- <div class="col-lg-6">
36
- <div class="mb-3 form-check">
37
- <input type="checkbox" class="form-check-input" name="linkify" id="linkify" />
38
- <label class="form-check-label" for="linkify">
39
- Autoconvert url-like texts to links
40
- </label>
41
- </div>
42
- <div class="mb-3 form-check">
43
- <input type="checkbox" class="form-check-input" name="externalBlank" id="externalBlank" />
44
- <label class="form-check-label" for="externalBlank">
45
- Open external links in a new tab/window
46
- </label>
47
- </div>
48
- <div class="mb-3 form-check">
49
- <input type="checkbox" class="form-check-input" name="nofollow" id="nofollow" />
50
- <label class="form-check-label" for="nofollow">
51
- Tell web crawlers that external links are not to be followed
52
- </label>
53
- </div>
54
- <div class="mb-3 form-check">
55
- <input type="checkbox" class="form-check-input" name="allowRTLO" id="allowRTLO" />
56
- <label class="form-check-label" for="allowRTLO">
57
- Allow RTL override unicode in link content
58
- </label>
59
- </div>
60
- <div class="mb-3 form-check">
61
- <input type="checkbox" class="form-check-input" name="checkboxes" id="checkboxes" />
62
- <label class="form-check-label" for="checkboxes">
63
- Interpret <code>[ ]</code> and <code>[x]</code> as checkboxes
64
- </label>
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>&lt;br /&gt;</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> &rarr; <code>&copy;</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
- </div>
70
- <div class="row">
71
- <div class="col-sm-6">
72
- <div class="card">
73
- <div class="card-header">Code Formatting</div>
74
- <div class="card-body">
75
- <div class="mb-3 form-check">
76
- <input type="checkbox" class="form-check-input" name="highlight" id="highlight" />
77
- <label class="form-check-label" for="highlight">
78
- Automatically detect and highlight code blocks
79
- </label>
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
- <div class="mb-3">
83
- <label class="form-label" for="highlightTheme">Use this theme for highlighted code blocks</label>
84
- <select class="form-control" name="highlightTheme" id="highlightTheme">
85
- {{{ each themes }}}
86
- <option value="{@value}">{@value}</option>
87
- {{{ end }}}
88
- </select>
89
- </div>
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
- <div class="mb-3">
92
- <label class="form-label" for="defaultHighlightLanguage">
93
- Default language for code blocks with no language defined
94
- </label>
95
- <input class="form-control" placeholder="e.g. js" type="text" name="defaultHighlightLanguage" id="defaultHighlightLanguage" />
96
- <p class="form-text">Leave blank to use auto-language detection</p>
97
- </div>
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
- <div class="mb-3">
100
- <label class="form-label" for="langPrefix">
101
- Prefix for <code>code</code> blocks
102
- </label>
103
- <input class="form-control" placeholder="language-" type="text" name="langPrefix" id="langPrefix" />
104
- </div>
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
- <div class="mb-3">
107
- <label class="form-label" for="hljsLanguages">Apply syntax highlighting to the following languages</label>
108
- <select class="form-select" multiple="true" name="hljsLanguages" id="hljsLanguages" size="20">
109
- <optgroup label="Pre-defined lists">
110
- <option value="all">All supported languages (greatest file size)</option>
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
- </optgroup>
118
- </select>
119
- <p class="form-text">
120
- You can use <code>ctrl</code> and <code>shift</code> to select/deselect multiple
121
- items and select/deselect items in ranges. <em>(Default: "Common languages".)</em>
122
- </p>
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
- </div>
146
- <div class="col-sm-6">
147
- <div class="card">
148
- <div class="card-header">Images</div>
149
- <div class="card-body">
150
- <div class="mb-3 form-check">
151
- <input type="checkbox" class="form-check-input" name="probe" id="probe" />
152
- <label class="form-check-label" for="probe">
153
- Append image sizes for externally linked images
154
- </label>
155
- </div>
156
- <div class="mb-3">
157
- <label class="form-label" for="probeCacheSize">Cache size (number of images)</label>
158
- <input class="form-control" type="number" id="probeCacheSize" name="probeCacheSize" placeholder="256 (Default)" />
159
- <p class="form-text">
160
- 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.
161
- </p>
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
- </div>
165
- <div class="card">
166
- <div class="card-header bg-danger text-light">Danger Zone</div>
167
- <div class="card-body">
168
- <div class="mb-3 form-check">
169
- <input type="checkbox" class="form-check-input" name="html" id="html" />
170
- <label class="form-check-label" for="html">
171
- Allow HTML
172
- </label>
173
- </div>
174
- <div class="alert alert-warning">
175
- <strong><i class="icon-warning-sign"></i> Careful!</strong>
176
- <p>
177
- Automatic HTML sanitization is an important part of ensuring that
178
- your users do not run arbitrary javascript or alter parts of the
179
- page that were not meant to be altered. If this option is checked,
180
- beware the consequences!
181
- </p>
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
- </div>
187
- </form>
189
+ </form>
190
+ </div>
188
191
  </div>
189
192
  </div>
190
-
191
- <!-- IMPORT admin/partials/save_button.tpl -->