nodebb-plugin-markdown 12.2.6 → 12.2.8
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/.jshintrc +85 -85
- package/README.md +9 -9
- package/index.js +16 -103
- package/package.json +1 -1
- package/public/languages/de/markdown.json +12 -12
- package/public/languages/en-GB/markdown.json +12 -12
- package/public/languages/fa-IR/markdown.json +11 -11
- package/public/languages/fr/markdown.json +11 -11
- package/public/languages/he/markdown.json +12 -12
- package/public/languages/pl/markdown.json +11 -11
- package/public/languages/tr/markdown.json +11 -11
- package/public/languages/zh-CN/markdown.json +11 -11
- package/public/scss/default.scss +9 -0
- package/public/templates/admin/plugins/markdown.tpl +0 -18
- package/package-lock.json +0 -7333
package/.jshintrc
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
{
|
|
2
|
-
// JSHint Default Configuration File (as on JSHint website)
|
|
3
|
-
// See http://jshint.com/docs/ for more details
|
|
4
|
-
|
|
5
|
-
"maxerr" : 50, // {int} Maximum error before stopping
|
|
6
|
-
|
|
7
|
-
// Enforcing
|
|
8
|
-
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
|
|
9
|
-
"camelcase" : false, // true: Identifiers must be in camelCase
|
|
10
|
-
"curly" : true, // true: Require {} for every new block or scope
|
|
11
|
-
"eqeqeq" : true, // true: Require triple equals (===) for comparison
|
|
12
|
-
"forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()
|
|
13
|
-
"immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
|
|
14
|
-
"indent" : 4, // {int} Number of spaces to use for indentation
|
|
15
|
-
"latedef" : false, // true: Require variables/functions to be defined before being used
|
|
16
|
-
"newcap" : false, // true: Require capitalization of all constructor functions e.g. `new F()`
|
|
17
|
-
"noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
|
|
18
|
-
"noempty" : true, // true: Prohibit use of empty blocks
|
|
19
|
-
"nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment)
|
|
20
|
-
"plusplus" : false, // true: Prohibit use of `++` & `--`
|
|
21
|
-
"quotmark" : false, // Quotation mark consistency:
|
|
22
|
-
// false : do nothing (default)
|
|
23
|
-
// true : ensure whatever is used is consistent
|
|
24
|
-
// "single" : require single quotes
|
|
25
|
-
// "double" : require double quotes
|
|
26
|
-
"undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
|
|
27
|
-
"unused" : true, // true: Require all defined variables be used
|
|
28
|
-
"strict" : true, // true: Requires all functions run in ES5 Strict Mode
|
|
29
|
-
"trailing" : false, // true: Prohibit trailing whitespaces
|
|
30
|
-
"maxparams" : false, // {int} Max number of formal params allowed per function
|
|
31
|
-
"maxdepth" : false, // {int} Max depth of nested blocks (within functions)
|
|
32
|
-
"maxstatements" : false, // {int} Max number statements per function
|
|
33
|
-
"maxcomplexity" : false, // {int} Max cyclomatic complexity per function
|
|
34
|
-
"maxlen" : false, // {int} Max number of characters per line
|
|
35
|
-
|
|
36
|
-
// Relaxing
|
|
37
|
-
"asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
|
|
38
|
-
"boss" : false, // true: Tolerate assignments where comparisons would be expected
|
|
39
|
-
"debug" : false, // true: Allow debugger statements e.g. browser breakpoints.
|
|
40
|
-
"eqnull" : false, // true: Tolerate use of `== null`
|
|
41
|
-
"es5" : false, // true: Allow ES5 syntax (ex: getters and setters)
|
|
42
|
-
"esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`)
|
|
43
|
-
"moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
|
|
44
|
-
// (ex: `for each`, multiple try/catch, function expression…)
|
|
45
|
-
"evil" : false, // true: Tolerate use of `eval` and `new Function()`
|
|
46
|
-
"expr" : false, // true: Tolerate `ExpressionStatement` as Programs
|
|
47
|
-
"funcscope" : false, // true: Tolerate defining variables inside control statements"
|
|
48
|
-
"globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
|
|
49
|
-
"iterator" : false, // true: Tolerate using the `__iterator__` property
|
|
50
|
-
"lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
|
|
51
|
-
"laxbreak" : false, // true: Tolerate possibly unsafe line breakings
|
|
52
|
-
"laxcomma" : false, // true: Tolerate comma-first style coding
|
|
53
|
-
"loopfunc" : false, // true: Tolerate functions being defined in loops
|
|
54
|
-
"multistr" : false, // true: Tolerate multi-line strings
|
|
55
|
-
"proto" : false, // true: Tolerate using the `__proto__` property
|
|
56
|
-
"scripturl" : false, // true: Tolerate script-targeted URLs
|
|
57
|
-
"smarttabs" : false, // true: Tolerate mixed tabs/spaces when used for alignment
|
|
58
|
-
"shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
|
|
59
|
-
"sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
|
|
60
|
-
"supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
|
|
61
|
-
"validthis" : false, // true: Tolerate using this in a non-constructor function
|
|
62
|
-
|
|
63
|
-
// Environments
|
|
64
|
-
"browser" : true, // Web Browser (window, document, etc)
|
|
65
|
-
"couch" : false, // CouchDB
|
|
66
|
-
"devel" : true, // Development/debugging (alert, confirm, etc)
|
|
67
|
-
"dojo" : false, // Dojo Toolkit
|
|
68
|
-
"jquery" : true, // jQuery
|
|
69
|
-
"mootools" : false, // MooTools
|
|
70
|
-
"node" : true, // Node.js
|
|
71
|
-
"nonstandard" : false, // Widely adopted globals (escape, unescape, etc)
|
|
72
|
-
"prototypejs" : false, // Prototype and Scriptaculous
|
|
73
|
-
"rhino" : false, // Rhino
|
|
74
|
-
"worker" : false, // Web Workers
|
|
75
|
-
"wsh" : false, // Windows Scripting Host
|
|
76
|
-
"yui" : false, // Yahoo User Interface
|
|
77
|
-
|
|
78
|
-
// Legacy
|
|
79
|
-
"nomen" : false, // true: Prohibit dangling `_` in variables
|
|
80
|
-
"onevar" : false, // true: Allow only one `var` statement per function
|
|
81
|
-
"passfail" : false, // true: Stop on first error
|
|
82
|
-
"white" : false, // true: Check against strict whitespace and indentation rules
|
|
83
|
-
|
|
84
|
-
// Custom Globals
|
|
85
|
-
"globals" : {} // additional predefined global variables
|
|
1
|
+
{
|
|
2
|
+
// JSHint Default Configuration File (as on JSHint website)
|
|
3
|
+
// See http://jshint.com/docs/ for more details
|
|
4
|
+
|
|
5
|
+
"maxerr" : 50, // {int} Maximum error before stopping
|
|
6
|
+
|
|
7
|
+
// Enforcing
|
|
8
|
+
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
|
|
9
|
+
"camelcase" : false, // true: Identifiers must be in camelCase
|
|
10
|
+
"curly" : true, // true: Require {} for every new block or scope
|
|
11
|
+
"eqeqeq" : true, // true: Require triple equals (===) for comparison
|
|
12
|
+
"forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()
|
|
13
|
+
"immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
|
|
14
|
+
"indent" : 4, // {int} Number of spaces to use for indentation
|
|
15
|
+
"latedef" : false, // true: Require variables/functions to be defined before being used
|
|
16
|
+
"newcap" : false, // true: Require capitalization of all constructor functions e.g. `new F()`
|
|
17
|
+
"noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
|
|
18
|
+
"noempty" : true, // true: Prohibit use of empty blocks
|
|
19
|
+
"nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment)
|
|
20
|
+
"plusplus" : false, // true: Prohibit use of `++` & `--`
|
|
21
|
+
"quotmark" : false, // Quotation mark consistency:
|
|
22
|
+
// false : do nothing (default)
|
|
23
|
+
// true : ensure whatever is used is consistent
|
|
24
|
+
// "single" : require single quotes
|
|
25
|
+
// "double" : require double quotes
|
|
26
|
+
"undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
|
|
27
|
+
"unused" : true, // true: Require all defined variables be used
|
|
28
|
+
"strict" : true, // true: Requires all functions run in ES5 Strict Mode
|
|
29
|
+
"trailing" : false, // true: Prohibit trailing whitespaces
|
|
30
|
+
"maxparams" : false, // {int} Max number of formal params allowed per function
|
|
31
|
+
"maxdepth" : false, // {int} Max depth of nested blocks (within functions)
|
|
32
|
+
"maxstatements" : false, // {int} Max number statements per function
|
|
33
|
+
"maxcomplexity" : false, // {int} Max cyclomatic complexity per function
|
|
34
|
+
"maxlen" : false, // {int} Max number of characters per line
|
|
35
|
+
|
|
36
|
+
// Relaxing
|
|
37
|
+
"asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
|
|
38
|
+
"boss" : false, // true: Tolerate assignments where comparisons would be expected
|
|
39
|
+
"debug" : false, // true: Allow debugger statements e.g. browser breakpoints.
|
|
40
|
+
"eqnull" : false, // true: Tolerate use of `== null`
|
|
41
|
+
"es5" : false, // true: Allow ES5 syntax (ex: getters and setters)
|
|
42
|
+
"esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`)
|
|
43
|
+
"moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
|
|
44
|
+
// (ex: `for each`, multiple try/catch, function expression…)
|
|
45
|
+
"evil" : false, // true: Tolerate use of `eval` and `new Function()`
|
|
46
|
+
"expr" : false, // true: Tolerate `ExpressionStatement` as Programs
|
|
47
|
+
"funcscope" : false, // true: Tolerate defining variables inside control statements"
|
|
48
|
+
"globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
|
|
49
|
+
"iterator" : false, // true: Tolerate using the `__iterator__` property
|
|
50
|
+
"lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
|
|
51
|
+
"laxbreak" : false, // true: Tolerate possibly unsafe line breakings
|
|
52
|
+
"laxcomma" : false, // true: Tolerate comma-first style coding
|
|
53
|
+
"loopfunc" : false, // true: Tolerate functions being defined in loops
|
|
54
|
+
"multistr" : false, // true: Tolerate multi-line strings
|
|
55
|
+
"proto" : false, // true: Tolerate using the `__proto__` property
|
|
56
|
+
"scripturl" : false, // true: Tolerate script-targeted URLs
|
|
57
|
+
"smarttabs" : false, // true: Tolerate mixed tabs/spaces when used for alignment
|
|
58
|
+
"shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
|
|
59
|
+
"sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
|
|
60
|
+
"supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
|
|
61
|
+
"validthis" : false, // true: Tolerate using this in a non-constructor function
|
|
62
|
+
|
|
63
|
+
// Environments
|
|
64
|
+
"browser" : true, // Web Browser (window, document, etc)
|
|
65
|
+
"couch" : false, // CouchDB
|
|
66
|
+
"devel" : true, // Development/debugging (alert, confirm, etc)
|
|
67
|
+
"dojo" : false, // Dojo Toolkit
|
|
68
|
+
"jquery" : true, // jQuery
|
|
69
|
+
"mootools" : false, // MooTools
|
|
70
|
+
"node" : true, // Node.js
|
|
71
|
+
"nonstandard" : false, // Widely adopted globals (escape, unescape, etc)
|
|
72
|
+
"prototypejs" : false, // Prototype and Scriptaculous
|
|
73
|
+
"rhino" : false, // Rhino
|
|
74
|
+
"worker" : false, // Web Workers
|
|
75
|
+
"wsh" : false, // Windows Scripting Host
|
|
76
|
+
"yui" : false, // Yahoo User Interface
|
|
77
|
+
|
|
78
|
+
// Legacy
|
|
79
|
+
"nomen" : false, // true: Prohibit dangling `_` in variables
|
|
80
|
+
"onevar" : false, // true: Allow only one `var` statement per function
|
|
81
|
+
"passfail" : false, // true: Stop on first error
|
|
82
|
+
"white" : false, // true: Check against strict whitespace and indentation rules
|
|
83
|
+
|
|
84
|
+
// Custom Globals
|
|
85
|
+
"globals" : {} // additional predefined global variables
|
|
86
86
|
}
|
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# NodeBB Markdown Parser
|
|
2
|
-
|
|
3
|
-
This NodeBB plugin is a parser that allows users to write posts using [Markdown](https://daringfireball.net/projects/markdown/).
|
|
4
|
-
|
|
5
|
-
To customise options for the parser, please consult the "Markdown" page in the administration panel, under the "Plugins" heading.
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
npm install nodebb-plugin-markdown
|
|
1
|
+
# NodeBB Markdown Parser
|
|
2
|
+
|
|
3
|
+
This NodeBB plugin is a parser that allows users to write posts using [Markdown](https://daringfireball.net/projects/markdown/).
|
|
4
|
+
|
|
5
|
+
To customise options for the parser, please consult the "Markdown" page in the administration panel, under the "Plugins" heading.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
npm install nodebb-plugin-markdown
|
package/index.js
CHANGED
|
@@ -4,12 +4,9 @@ const MarkdownIt = require('markdown-it');
|
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
|
|
7
|
-
const probe = require('probe-image-size');
|
|
8
|
-
|
|
9
7
|
const nconf = require.main.require('nconf');
|
|
10
8
|
const winston = require.main.require('winston');
|
|
11
9
|
const meta = require.main.require('./src/meta');
|
|
12
|
-
const posts = require.main.require('./src/posts');
|
|
13
10
|
const translator = require.main.require('./src/translator');
|
|
14
11
|
const plugins = require.main.require('./src/plugins');
|
|
15
12
|
const cacheCreate = require.main.require('./src/cacheCreate');
|
|
@@ -21,8 +18,6 @@ let parser;
|
|
|
21
18
|
let app;
|
|
22
19
|
const Markdown = {
|
|
23
20
|
config: {},
|
|
24
|
-
_externalImageCache: undefined,
|
|
25
|
-
_externalImageFailures: new Set(),
|
|
26
21
|
onLoad: async function (params) {
|
|
27
22
|
app = params.app;
|
|
28
23
|
const { router } = params;
|
|
@@ -88,9 +83,6 @@ const Markdown = {
|
|
|
88
83
|
highlight: true,
|
|
89
84
|
highlightTheme: 'default.css',
|
|
90
85
|
|
|
91
|
-
probe: true,
|
|
92
|
-
probeCacheSize: 256,
|
|
93
|
-
|
|
94
86
|
xhtmlOut: true,
|
|
95
87
|
breaks: true,
|
|
96
88
|
linkify: true,
|
|
@@ -101,7 +93,7 @@ const Markdown = {
|
|
|
101
93
|
checkboxes: true,
|
|
102
94
|
multimdTables: true,
|
|
103
95
|
};
|
|
104
|
-
const notCheckboxes = ['langPrefix', 'highlightTheme'
|
|
96
|
+
const notCheckboxes = ['langPrefix', 'highlightTheme'];
|
|
105
97
|
|
|
106
98
|
meta.settings.get('markdown', (err, options) => {
|
|
107
99
|
if (err) {
|
|
@@ -125,15 +117,6 @@ const Markdown = {
|
|
|
125
117
|
parser = new MarkdownIt(_self.config);
|
|
126
118
|
|
|
127
119
|
Markdown.updateParserRules(parser);
|
|
128
|
-
|
|
129
|
-
// External image size cache
|
|
130
|
-
if (_self.config.probe) {
|
|
131
|
-
Markdown._externalImageCache = cacheCreate({
|
|
132
|
-
name: 'markdown.externalImageCache',
|
|
133
|
-
max: parseInt(_self.config.probeCacheSize, 10) || 256,
|
|
134
|
-
ttl: 1000 * 60 * 60 * 24, // 1 day
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
120
|
});
|
|
138
121
|
},
|
|
139
122
|
|
|
@@ -174,62 +157,11 @@ const Markdown = {
|
|
|
174
157
|
return Markdown.afterParse(raw);
|
|
175
158
|
},
|
|
176
159
|
|
|
177
|
-
beforeParse: async (data) => {
|
|
160
|
+
beforeParse: async (/* data */) => {
|
|
178
161
|
const env = {
|
|
179
162
|
images: new Map(),
|
|
180
163
|
};
|
|
181
164
|
|
|
182
|
-
if (data && data.postData && data.postData.pid) {
|
|
183
|
-
// Check that pid for images, and return their sizes
|
|
184
|
-
const images = await posts.uploads.listWithSizes(data.postData.pid);
|
|
185
|
-
env.images = images.reduce((memo, cur) => {
|
|
186
|
-
memo.set(cur.name, cur);
|
|
187
|
-
delete cur.name;
|
|
188
|
-
return memo;
|
|
189
|
-
}, env.images);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// Probe post data for external images as well
|
|
193
|
-
if (Markdown.config.probe && data && data.postData && data.postData.content) {
|
|
194
|
-
const matcher = /!\[[^\]]*?\]\((https?[^)]+?)\)/g;
|
|
195
|
-
let current;
|
|
196
|
-
|
|
197
|
-
// eslint-disable-next-line no-cond-assign
|
|
198
|
-
while ((current = matcher.exec(data.postData.content)) !== null) {
|
|
199
|
-
const match = current[1];
|
|
200
|
-
if (match && Markdown.isExternalLink(match)) { // for security only parse external images
|
|
201
|
-
const parsedUrl = new URL(match, nconf.get('url'));
|
|
202
|
-
const filename = path.basename(parsedUrl.pathname);
|
|
203
|
-
const size = Markdown._externalImageCache.get(match);
|
|
204
|
-
|
|
205
|
-
// Short-circuit to ignore previous failures
|
|
206
|
-
const hasFailed = Markdown._externalImageFailures.has(match);
|
|
207
|
-
if (!hasFailed) {
|
|
208
|
-
if (size) {
|
|
209
|
-
env.images.set(filename, size);
|
|
210
|
-
} else {
|
|
211
|
-
// Size checked asynchronously, see: https://github.com/tomas/needle/issues/389
|
|
212
|
-
probe(match, {
|
|
213
|
-
follow_max: 2,
|
|
214
|
-
}).then((size) => {
|
|
215
|
-
let { width, height } = size;
|
|
216
|
-
|
|
217
|
-
// Swap width and height if orientation bit is set
|
|
218
|
-
if (size.orientation >= 5 && size.orientation <= 8) {
|
|
219
|
-
[width, height] = [height, width];
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
Markdown._externalImageCache.set(match, { width, height });
|
|
223
|
-
}).catch(() => {
|
|
224
|
-
// Likely an issue getting the external image size, ignore in the future
|
|
225
|
-
Markdown._externalImageFailures.add(match);
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
165
|
return env;
|
|
234
166
|
},
|
|
235
167
|
|
|
@@ -351,55 +283,35 @@ const Markdown = {
|
|
|
351
283
|
parser.renderer.rules.image = function (tokens, idx, options, env, self) {
|
|
352
284
|
const token = tokens[idx];
|
|
353
285
|
const attributes = new Map(token.attrs);
|
|
354
|
-
const parsedSrc = new URL(attributes.get('src'), nconf.get('url'));
|
|
355
286
|
|
|
356
287
|
// Validate the url
|
|
357
288
|
if (!Markdown.isUrlValid(attributes.get('src'))) { return ''; }
|
|
358
289
|
|
|
359
290
|
token.attrSet('class', `${token.attrGet('class') || ''} img-fluid img-markdown`);
|
|
360
291
|
|
|
361
|
-
// Append sizes to images
|
|
362
|
-
if (parsedSrc.pathname) {
|
|
363
|
-
const filename = path.basename(parsedSrc.pathname);
|
|
364
|
-
if (env.images && env.images.has(filename)) {
|
|
365
|
-
const size = env.images.get(filename);
|
|
366
|
-
token.attrSet('width', size.width);
|
|
367
|
-
token.attrSet('height', size.height);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
292
|
return renderImage(tokens, idx, options, env, self);
|
|
372
293
|
};
|
|
373
294
|
|
|
374
295
|
parser.renderer.rules.link_open = function (tokens, idx, options, env, self) {
|
|
375
|
-
|
|
376
|
-
const targetIdx = tokens[idx].attrIndex('target');
|
|
377
|
-
let relIdx = tokens[idx].attrIndex('rel');
|
|
378
|
-
const hrefIdx = tokens[idx].attrIndex('href');
|
|
296
|
+
const attributes = new Map(tokens[idx].attrs);
|
|
379
297
|
|
|
380
|
-
if (Markdown.isExternalLink(
|
|
298
|
+
if (attributes.has('href') && Markdown.isExternalLink(attributes.get('href'))) {
|
|
299
|
+
const rel = [];
|
|
381
300
|
if (Markdown.config.externalBlank) {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
} else {
|
|
385
|
-
tokens[idx].attrs[targetIdx][1] = '_blank';
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
if (relIdx < 0) {
|
|
389
|
-
tokens[idx].attrPush(['rel', 'noopener noreferrer']);
|
|
390
|
-
relIdx = tokens[idx].attrIndex('rel');
|
|
391
|
-
} else {
|
|
392
|
-
tokens[idx].attrs[relIdx][1] = 'noopener noreferrer';
|
|
393
|
-
}
|
|
301
|
+
attributes.set('target', '_blank');
|
|
302
|
+
rel.push('noopener', 'noreferrer');
|
|
394
303
|
}
|
|
395
304
|
|
|
396
305
|
if (Markdown.config.nofollow) {
|
|
397
|
-
|
|
398
|
-
tokens[idx].attrPush(['rel', 'nofollow ugc']);
|
|
399
|
-
} else {
|
|
400
|
-
tokens[idx].attrs[relIdx][1] += ' nofollow ugc';
|
|
401
|
-
}
|
|
306
|
+
rel.push('nofollow', 'ugc');
|
|
402
307
|
}
|
|
308
|
+
|
|
309
|
+
attributes.set('rel', rel.join(' '));
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// Clearly indicate hidden links
|
|
313
|
+
if (tokens[idx + 1].type === 'link_close') {
|
|
314
|
+
attributes.set('class', String(`${attributes.get('class') || ''} plugin-markdown-hidden-link small link-danger`).trim());
|
|
403
315
|
}
|
|
404
316
|
|
|
405
317
|
if (!Markdown.config.allowRTLO) {
|
|
@@ -410,6 +322,7 @@ const Markdown = {
|
|
|
410
322
|
}
|
|
411
323
|
}
|
|
412
324
|
|
|
325
|
+
tokens[idx].attrs = Array.from(attributes);
|
|
413
326
|
return renderLink(tokens, idx, options, env, self);
|
|
414
327
|
};
|
|
415
328
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
{
|
|
2
|
-
"bold": "Fettschrift",
|
|
3
|
-
"italic": "Kursivschrift",
|
|
4
|
-
"list-item": "Listenpunkt",
|
|
5
|
-
"strikethrough-text": "Durchgestrichen",
|
|
6
|
-
"code-text": "code_text",
|
|
7
|
-
"link-text": "Link Text",
|
|
8
|
-
"link-url": "Link Adresse",
|
|
9
|
-
"picture-text": "Bild Text",
|
|
10
|
-
"picture-url": "Bild Link",
|
|
11
|
-
"help-text": "Dieses Forum unterstützt Markdown. Für mehr Informationen, [hier klicken](http://commonmark.org/help/)"
|
|
12
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"bold": "Fettschrift",
|
|
3
|
+
"italic": "Kursivschrift",
|
|
4
|
+
"list-item": "Listenpunkt",
|
|
5
|
+
"strikethrough-text": "Durchgestrichen",
|
|
6
|
+
"code-text": "code_text",
|
|
7
|
+
"link-text": "Link Text",
|
|
8
|
+
"link-url": "Link Adresse",
|
|
9
|
+
"picture-text": "Bild Text",
|
|
10
|
+
"picture-url": "Bild Link",
|
|
11
|
+
"help-text": "Dieses Forum unterstützt Markdown. Für mehr Informationen, [hier klicken](http://commonmark.org/help/)"
|
|
12
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
{
|
|
2
|
-
"bold": "bolded text",
|
|
3
|
-
"italic": "italicised text",
|
|
4
|
-
"list-item": "list item",
|
|
5
|
-
"heading": "heading",
|
|
6
|
-
"strikethrough-text": "strikethrough text",
|
|
7
|
-
"code-text": "code_text",
|
|
8
|
-
"link-text": "link text",
|
|
9
|
-
"link-url": "link url",
|
|
10
|
-
"picture-text": "alt text",
|
|
11
|
-
"picture-url": "image url",
|
|
12
|
-
"help-text": "This forum is powered by Markdown. For full documentation, [click here](http://commonmark.org/help/)"
|
|
1
|
+
{
|
|
2
|
+
"bold": "bolded text",
|
|
3
|
+
"italic": "italicised text",
|
|
4
|
+
"list-item": "list item",
|
|
5
|
+
"heading": "heading",
|
|
6
|
+
"strikethrough-text": "strikethrough text",
|
|
7
|
+
"code-text": "code_text",
|
|
8
|
+
"link-text": "link text",
|
|
9
|
+
"link-url": "link url",
|
|
10
|
+
"picture-text": "alt text",
|
|
11
|
+
"picture-url": "image url",
|
|
12
|
+
"help-text": "This forum is powered by Markdown. For full documentation, [click here](http://commonmark.org/help/)"
|
|
13
13
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
{
|
|
2
|
-
"bold": "متن پررنگ",
|
|
3
|
-
"italic": "متن ایتالیک ( کج )",
|
|
4
|
-
"list-item": "لیست",
|
|
5
|
-
"strikethrough-text": "متن خط خورده",
|
|
6
|
-
"link-text": "متن لینک",
|
|
7
|
-
"link-url": "آدرس لینک",
|
|
8
|
-
"picture-text": "متن جایگزین",
|
|
9
|
-
"picture-url": "آدرس عکس",
|
|
10
|
-
"help-text": "این انجمن از زبان مارک دون استفاده می کند، برای اطلاعات بیشتر [اینجا](http://commonmark.org/help/) کلیک کنید!"
|
|
11
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"bold": "متن پررنگ",
|
|
3
|
+
"italic": "متن ایتالیک ( کج )",
|
|
4
|
+
"list-item": "لیست",
|
|
5
|
+
"strikethrough-text": "متن خط خورده",
|
|
6
|
+
"link-text": "متن لینک",
|
|
7
|
+
"link-url": "آدرس لینک",
|
|
8
|
+
"picture-text": "متن جایگزین",
|
|
9
|
+
"picture-url": "آدرس عکس",
|
|
10
|
+
"help-text": "این انجمن از زبان مارک دون استفاده می کند، برای اطلاعات بیشتر [اینجا](http://commonmark.org/help/) کلیک کنید!"
|
|
11
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
{
|
|
2
|
-
"bold": "texte en gras",
|
|
3
|
-
"italic": "texte en italique",
|
|
4
|
-
"list-item": "élément de liste",
|
|
5
|
-
"strikethrough-text": "strikethrough text",
|
|
6
|
-
"link-text": "texte du lien",
|
|
7
|
-
"link-url": "url du lien",
|
|
8
|
-
"picture-text": "text alternatif",
|
|
9
|
-
"picture-url": "url de l'image",
|
|
10
|
-
"help-text": "Ce forum utilise la syntaxe Markdown. Pour accéder à la documentation, suivre ce [lien](http://commonmark.org/help/)"
|
|
11
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"bold": "texte en gras",
|
|
3
|
+
"italic": "texte en italique",
|
|
4
|
+
"list-item": "élément de liste",
|
|
5
|
+
"strikethrough-text": "strikethrough text",
|
|
6
|
+
"link-text": "texte du lien",
|
|
7
|
+
"link-url": "url du lien",
|
|
8
|
+
"picture-text": "text alternatif",
|
|
9
|
+
"picture-url": "url de l'image",
|
|
10
|
+
"help-text": "Ce forum utilise la syntaxe Markdown. Pour accéder à la documentation, suivre ce [lien](http://commonmark.org/help/)"
|
|
11
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
{
|
|
2
|
-
"bold": "טקסט מודגש",
|
|
3
|
-
"italic": "טקסט נטוי",
|
|
4
|
-
"list-item": "פריט רשימה",
|
|
5
|
-
"strikethrough-text": "קו חוצה",
|
|
6
|
-
"code-text": "קוד",
|
|
7
|
-
"link-text": "טקסט קישור",
|
|
8
|
-
"link-url": "כתובת קישור",
|
|
9
|
-
"picture-text": "כיתוב בבעיות טעינה",
|
|
10
|
-
"picture-url": "כתובת תמונה",
|
|
11
|
-
"help-text": "הפורום עובד עם Markdown. להסבר מלא, [לחץ כאן](http://commonmark.org/help/)"
|
|
12
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"bold": "טקסט מודגש",
|
|
3
|
+
"italic": "טקסט נטוי",
|
|
4
|
+
"list-item": "פריט רשימה",
|
|
5
|
+
"strikethrough-text": "קו חוצה",
|
|
6
|
+
"code-text": "קוד",
|
|
7
|
+
"link-text": "טקסט קישור",
|
|
8
|
+
"link-url": "כתובת קישור",
|
|
9
|
+
"picture-text": "כיתוב בבעיות טעינה",
|
|
10
|
+
"picture-url": "כתובת תמונה",
|
|
11
|
+
"help-text": "הפורום עובד עם Markdown. להסבר מלא, [לחץ כאן](http://commonmark.org/help/)"
|
|
12
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
{
|
|
2
|
-
"bold": "pogrubienie",
|
|
3
|
-
"italic": "pochylenie",
|
|
4
|
-
"list-item": "wypunktowanie",
|
|
5
|
-
"strikethrough-text": "przekreślenie",
|
|
6
|
-
"link-text": "tekst odnośnika",
|
|
7
|
-
"link-url": "url odnośnika",
|
|
8
|
-
"picture-text": "text alternatywny",
|
|
9
|
-
"picture-url": "url obrazu",
|
|
10
|
-
"help-text": "Forum działa dzięki Markdown. By uzyskać pełną dokumentację, [kliknij tutaj](http://commonmark.org/help/)"
|
|
11
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"bold": "pogrubienie",
|
|
3
|
+
"italic": "pochylenie",
|
|
4
|
+
"list-item": "wypunktowanie",
|
|
5
|
+
"strikethrough-text": "przekreślenie",
|
|
6
|
+
"link-text": "tekst odnośnika",
|
|
7
|
+
"link-url": "url odnośnika",
|
|
8
|
+
"picture-text": "text alternatywny",
|
|
9
|
+
"picture-url": "url obrazu",
|
|
10
|
+
"help-text": "Forum działa dzięki Markdown. By uzyskać pełną dokumentację, [kliknij tutaj](http://commonmark.org/help/)"
|
|
11
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
{
|
|
2
|
-
"bold": "kalın yazı",
|
|
3
|
-
"italic": "İtalik yazı",
|
|
4
|
-
"list-item": "liste madde",
|
|
5
|
-
"strikethrough-text": "Üstü çizili metin",
|
|
6
|
-
"link-text": "bağlantı metni",
|
|
7
|
-
"link-url": "link url",
|
|
8
|
-
"picture-text": "alt metni",
|
|
9
|
-
"picture-url": "görsel url",
|
|
10
|
-
"help-text": "This forum is powered by Markdown. For full documentation, [click here](http://commonmark.org/help/)"
|
|
11
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"bold": "kalın yazı",
|
|
3
|
+
"italic": "İtalik yazı",
|
|
4
|
+
"list-item": "liste madde",
|
|
5
|
+
"strikethrough-text": "Üstü çizili metin",
|
|
6
|
+
"link-text": "bağlantı metni",
|
|
7
|
+
"link-url": "link url",
|
|
8
|
+
"picture-text": "alt metni",
|
|
9
|
+
"picture-url": "görsel url",
|
|
10
|
+
"help-text": "This forum is powered by Markdown. For full documentation, [click here](http://commonmark.org/help/)"
|
|
11
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
{
|
|
2
|
-
"bold": "粗体字",
|
|
3
|
-
"italic": "斜体字",
|
|
4
|
-
"list-item": "列表",
|
|
5
|
-
"strikethrough-text": "删除线",
|
|
6
|
-
"link-text": "链接文本",
|
|
7
|
-
"link-url": "链接地址",
|
|
8
|
-
"picture-text": "替代文字",
|
|
9
|
-
"picture-url": "图片地址",
|
|
10
|
-
"help-text": "该论坛使用 Markdown 语法。[点此查看](http://commonmark.org/help/) 语法说明。"
|
|
11
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"bold": "粗体字",
|
|
3
|
+
"italic": "斜体字",
|
|
4
|
+
"list-item": "列表",
|
|
5
|
+
"strikethrough-text": "删除线",
|
|
6
|
+
"link-text": "链接文本",
|
|
7
|
+
"link-url": "链接地址",
|
|
8
|
+
"picture-text": "替代文字",
|
|
9
|
+
"picture-url": "图片地址",
|
|
10
|
+
"help-text": "该论坛使用 Markdown 语法。[点此查看](http://commonmark.org/help/) 语法说明。"
|
|
11
|
+
}
|
package/public/scss/default.scss
CHANGED
|
@@ -148,24 +148,6 @@
|
|
|
148
148
|
</div>
|
|
149
149
|
</div>
|
|
150
150
|
|
|
151
|
-
<div class="mb-4">
|
|
152
|
-
<h5 class="fw-bold tracking-tight settings-header">Images</h5>
|
|
153
|
-
|
|
154
|
-
<div class="mb-3 form-check form-switch">
|
|
155
|
-
<input type="checkbox" class="form-check-input" name="probe" id="probe" />
|
|
156
|
-
<label class="form-check-label" for="probe">
|
|
157
|
-
Append image sizes for externally linked images
|
|
158
|
-
</label>
|
|
159
|
-
</div>
|
|
160
|
-
<div class="mb-3">
|
|
161
|
-
<label class="form-label" for="probeCacheSize">Cache size (number of images)</label>
|
|
162
|
-
<input class="form-control" type="number" id="probeCacheSize" name="probeCacheSize" placeholder="256 (Default)" />
|
|
163
|
-
<p class="form-text">
|
|
164
|
-
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.
|
|
165
|
-
</p>
|
|
166
|
-
</div>
|
|
167
|
-
</div>
|
|
168
|
-
|
|
169
151
|
<div class="mb-4">
|
|
170
152
|
<h5 class="fw-bold tracking-tight settings-header">HTML Sanitization</h5>
|
|
171
153
|
|