nodebb-plugin-markdown 9.0.7 → 9.0.10

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/.eslintignore CHANGED
@@ -1,2 +1,2 @@
1
- public/js/highlight.js
1
+ public/js/highlight.js
2
2
  public/js/highlightjs-line-numbers.js
package/.eslintrc CHANGED
@@ -1,128 +1,128 @@
1
- {
2
- "extends": "airbnb-base",
3
- "parserOptions": {
4
- "sourceType": "script"
5
- },
6
-
7
- "rules": {
8
- // Customized
9
- "handle-callback-err": [ "error","^(e$|(e|(.*(_e|E)))rr)" ],
10
- "comma-dangle": ["error", {
11
- "arrays": "always-multiline",
12
- "objects": "always-multiline",
13
- "imports": "always-multiline",
14
- "exports": "always-multiline",
15
- "functions": "never"
16
- }],
17
- "no-empty": ["error", { "allowEmptyCatch": true }],
18
- "no-underscore-dangle": "off",
19
- "newline-per-chained-call": "off",
20
- "no-console": "off",
21
- "no-mixed-operators": ["error", { "allowSamePrecedence": true }],
22
- "strict": ["error", "global"],
23
- "consistent-return": "off",
24
- "func-names": "off",
25
- "no-tabs": "off",
26
- "indent": ["error", "tab"],
27
- "no-eq-null": "off",
28
- "camelcase": "off",
29
- "no-new": "off",
30
- "no-shadow": "off",
31
- "no-use-before-define": ["error", "nofunc"],
32
- "no-prototype-builtins": "off",
33
- "new-cap": "off",
34
- "no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
35
- "import/no-unresolved": "error",
36
-
37
- // ES6
38
- "prefer-rest-params": "off",
39
- "prefer-spread": "off",
40
- "prefer-arrow-callback": "off",
41
- "prefer-template": "off",
42
- "no-var": "off",
43
- "object-shorthand": "off",
44
- "vars-on-top": "off",
45
-
46
- // TODO
47
- "import/no-extraneous-dependencies": "off",
48
- "import/no-dynamic-require": "off",
49
- "import/newline-after-import": "off",
50
- "no-bitwise": "off",
51
- "global-require": "off",
52
- "max-len": "off",
53
- "no-param-reassign": "off",
54
- "no-restricted-syntax": "off",
55
- "no-script-url": "off",
56
- "default-case": "off",
57
- "linebreak-style": "off",
58
-
59
- // "no-multi-assign": "off",
60
- // "one-var": "off",
61
- // "no-undef": "off",
62
- // "max-nested-callbacks": "off",
63
- // "no-mixed-requires": "off",
64
- // "brace-style": "off",
65
- // "max-statements-per-line": "off",
66
- // "no-unused-vars": "off",
67
- // "no-mixed-spaces-and-tabs": "off",
68
- // "no-useless-concat": "off",
69
- // "require-jsdoc": "off",
70
- // "eqeqeq": "off",
71
- // "no-negated-condition": "off",
72
- // "one-var-declaration-per-line": "off",
73
- // "no-lonely-if": "off",
74
- // "radix": "off",
75
- // "no-else-return": "off",
76
- // "no-useless-escape": "off",
77
- // "block-scoped-var": "off",
78
- // "operator-assignment": "off",
79
- // "yoda": "off",
80
- // "no-loop-func": "off",
81
- // "no-void": "off",
82
- // "valid-jsdoc": "off",
83
- // "no-cond-assign": "off",
84
- // "no-redeclare": "off",
85
- // "no-unreachable": "off",
86
- // "no-nested-ternary": "off",
87
- // "operator-linebreak": "off",
88
- // "guard-for-in": "off",
89
- // "no-unneeded-ternary": "off",
90
- // "no-sequences": "off",
91
- // "no-extend-native": "off",
92
- // "no-shadow-restricted-names": "off",
93
- // "no-extra-boolean-cast": "off",
94
- // "no-path-concat": "off",
95
- // "no-unused-expressions": "off",
96
- // "no-return-assign": "off",
97
- // "no-restricted-modules": "off",
98
- // "object-curly-spacing": "off",
99
- // "indent": "off",
100
- // "padded-blocks": "off",
101
- // "eol-last": "off",
102
- // "lines-around-directive": "off",
103
- // "strict": "off",
104
- // "comma-dangle": "off",
105
- // "no-multi-spaces": "off",
106
- // "quotes": "off",
107
- // "keyword-spacing": "off",
108
- // "no-mixed-operators": "off",
109
- // "comma-spacing": "off",
110
- // "no-trailing-spaces": "off",
111
- // "key-spacing": "off",
112
- // "no-multiple-empty-lines": "off",
113
- // "spaced-comment": "off",
114
- // "space-in-parens": "off",
115
- // "block-spacing": "off",
116
- // "quote-props": "off",
117
- // "space-unary-ops": "off",
118
- // "no-empty": "off",
119
- // "dot-notation": "off",
120
- // "func-call-spacing": "off",
121
- // "array-bracket-spacing": "off",
122
- // "object-property-newline": "off",
123
- // "no-continue": "off",
124
- // "no-extra-semi": "off",
125
- // "no-spaced-func": "off",
126
- // "no-useless-return": "off"
127
- }
128
- }
1
+ {
2
+ "extends": "airbnb-base",
3
+ "parserOptions": {
4
+ "sourceType": "script"
5
+ },
6
+
7
+ "rules": {
8
+ // Customized
9
+ "handle-callback-err": [ "error","^(e$|(e|(.*(_e|E)))rr)" ],
10
+ "comma-dangle": ["error", {
11
+ "arrays": "always-multiline",
12
+ "objects": "always-multiline",
13
+ "imports": "always-multiline",
14
+ "exports": "always-multiline",
15
+ "functions": "never"
16
+ }],
17
+ "no-empty": ["error", { "allowEmptyCatch": true }],
18
+ "no-underscore-dangle": "off",
19
+ "newline-per-chained-call": "off",
20
+ "no-console": "off",
21
+ "no-mixed-operators": ["error", { "allowSamePrecedence": true }],
22
+ "strict": ["error", "global"],
23
+ "consistent-return": "off",
24
+ "func-names": "off",
25
+ "no-tabs": "off",
26
+ "indent": ["error", "tab"],
27
+ "no-eq-null": "off",
28
+ "camelcase": "off",
29
+ "no-new": "off",
30
+ "no-shadow": "off",
31
+ "no-use-before-define": ["error", "nofunc"],
32
+ "no-prototype-builtins": "off",
33
+ "new-cap": "off",
34
+ "no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
35
+ "import/no-unresolved": "error",
36
+
37
+ // ES6
38
+ "prefer-rest-params": "off",
39
+ "prefer-spread": "off",
40
+ "prefer-arrow-callback": "off",
41
+ "prefer-template": "off",
42
+ "no-var": "off",
43
+ "object-shorthand": "off",
44
+ "vars-on-top": "off",
45
+
46
+ // TODO
47
+ "import/no-extraneous-dependencies": "off",
48
+ "import/no-dynamic-require": "off",
49
+ "import/newline-after-import": "off",
50
+ "no-bitwise": "off",
51
+ "global-require": "off",
52
+ "max-len": "off",
53
+ "no-param-reassign": "off",
54
+ "no-restricted-syntax": "off",
55
+ "no-script-url": "off",
56
+ "default-case": "off",
57
+ "linebreak-style": "off",
58
+
59
+ // "no-multi-assign": "off",
60
+ // "one-var": "off",
61
+ // "no-undef": "off",
62
+ // "max-nested-callbacks": "off",
63
+ // "no-mixed-requires": "off",
64
+ // "brace-style": "off",
65
+ // "max-statements-per-line": "off",
66
+ // "no-unused-vars": "off",
67
+ // "no-mixed-spaces-and-tabs": "off",
68
+ // "no-useless-concat": "off",
69
+ // "require-jsdoc": "off",
70
+ // "eqeqeq": "off",
71
+ // "no-negated-condition": "off",
72
+ // "one-var-declaration-per-line": "off",
73
+ // "no-lonely-if": "off",
74
+ // "radix": "off",
75
+ // "no-else-return": "off",
76
+ // "no-useless-escape": "off",
77
+ // "block-scoped-var": "off",
78
+ // "operator-assignment": "off",
79
+ // "yoda": "off",
80
+ // "no-loop-func": "off",
81
+ // "no-void": "off",
82
+ // "valid-jsdoc": "off",
83
+ // "no-cond-assign": "off",
84
+ // "no-redeclare": "off",
85
+ // "no-unreachable": "off",
86
+ // "no-nested-ternary": "off",
87
+ // "operator-linebreak": "off",
88
+ // "guard-for-in": "off",
89
+ // "no-unneeded-ternary": "off",
90
+ // "no-sequences": "off",
91
+ // "no-extend-native": "off",
92
+ // "no-shadow-restricted-names": "off",
93
+ // "no-extra-boolean-cast": "off",
94
+ // "no-path-concat": "off",
95
+ // "no-unused-expressions": "off",
96
+ // "no-return-assign": "off",
97
+ // "no-restricted-modules": "off",
98
+ // "object-curly-spacing": "off",
99
+ // "indent": "off",
100
+ // "padded-blocks": "off",
101
+ // "eol-last": "off",
102
+ // "lines-around-directive": "off",
103
+ // "strict": "off",
104
+ // "comma-dangle": "off",
105
+ // "no-multi-spaces": "off",
106
+ // "quotes": "off",
107
+ // "keyword-spacing": "off",
108
+ // "no-mixed-operators": "off",
109
+ // "comma-spacing": "off",
110
+ // "no-trailing-spaces": "off",
111
+ // "key-spacing": "off",
112
+ // "no-multiple-empty-lines": "off",
113
+ // "spaced-comment": "off",
114
+ // "space-in-parens": "off",
115
+ // "block-spacing": "off",
116
+ // "quote-props": "off",
117
+ // "space-unary-ops": "off",
118
+ // "no-empty": "off",
119
+ // "dot-notation": "off",
120
+ // "func-call-spacing": "off",
121
+ // "array-bracket-spacing": "off",
122
+ // "object-property-newline": "off",
123
+ // "no-continue": "off",
124
+ // "no-extra-semi": "off",
125
+ // "no-spaced-func": "off",
126
+ // "no-useless-return": "off"
127
+ }
128
+ }
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
@@ -23,6 +23,7 @@ let parser;
23
23
  const Markdown = {
24
24
  config: {},
25
25
  _externalImageCache: undefined,
26
+ _externalImageFailures: new Set(),
26
27
  onLoad: async function (params) {
27
28
  const controllers = require('./lib/controllers');
28
29
  const hostMiddleware = require.main.require('./src/middleware');
@@ -209,13 +210,20 @@ const Markdown = {
209
210
  const parsedUrl = url.parse(match);
210
211
  const filename = path.basename(parsedUrl.pathname);
211
212
  const size = Markdown._externalImageCache.get(match);
213
+
214
+ // Short-circuit to ignore previous failures
215
+ const hasFailed = Markdown._externalImageFailures.has(match);
216
+ if (hasFailed) {
217
+ return;
218
+ }
219
+
212
220
  if (size) {
213
221
  env.images.set(filename, size);
214
222
  } else {
215
- try {
216
- // eslint-disable-next-line no-await-in-loop
217
- const size = await probe(match);
218
-
223
+ // Size checked asynchronously, see: https://github.com/tomas/needle/issues/389
224
+ probe(match, {
225
+ follow_max: 2,
226
+ }).then((size) => {
219
227
  let { width, height } = size;
220
228
 
221
229
  // Swap width and height if orientation bit is set
@@ -225,9 +233,10 @@ const Markdown = {
225
233
 
226
234
  env.images.set(filename, { width, height });
227
235
  Markdown._externalImageCache.set(match, { width, height });
228
- } catch (e) {
229
- // No handling required
230
- }
236
+ }).catch(() => {
237
+ // Likely an issue getting the external image size, ignore in the future
238
+ Markdown._externalImageFailures.add(match);
239
+ });
231
240
  }
232
241
  }
233
242
  }
@@ -1,32 +1,32 @@
1
- 'use strict';
2
-
3
- const parent = module.parent.exports;
4
- const posts = require.main.require('./src/posts');
5
- const Controllers = {};
6
-
7
- Controllers.renderAdmin = function renderAdmin(req, res) {
8
- res.render('admin/plugins/markdown', {
9
- themes: parent.themes,
10
- });
11
- };
12
-
13
- Controllers.retrieveRaw = function retrieveRaw(req, res, next) {
14
- const pid = parseInt(req.params.pid, 10);
15
-
16
- if (!pid) {
17
- return next();
18
- }
19
-
20
- posts.getPostField(pid, 'content', function (err, content) {
21
- if (err) {
22
- return next(err);
23
- }
24
-
25
- res.json({
26
- pid: pid,
27
- content: content,
28
- });
29
- });
30
- };
31
-
32
- module.exports = Controllers;
1
+ 'use strict';
2
+
3
+ const parent = module.parent.exports;
4
+ const posts = require.main.require('./src/posts');
5
+ const Controllers = {};
6
+
7
+ Controllers.renderAdmin = function renderAdmin(req, res) {
8
+ res.render('admin/plugins/markdown', {
9
+ themes: parent.themes,
10
+ });
11
+ };
12
+
13
+ Controllers.retrieveRaw = function retrieveRaw(req, res, next) {
14
+ const pid = parseInt(req.params.pid, 10);
15
+
16
+ if (!pid) {
17
+ return next();
18
+ }
19
+
20
+ posts.getPostField(pid, 'content', function (err, content) {
21
+ if (err) {
22
+ return next(err);
23
+ }
24
+
25
+ res.json({
26
+ pid: pid,
27
+ content: content,
28
+ });
29
+ });
30
+ };
31
+
32
+ module.exports = Controllers;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-markdown",
3
- "version": "9.0.7",
3
+ "version": "9.0.10",
4
4
  "description": "A Markdown parser for NodeBB",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -42,10 +42,10 @@
42
42
  "devDependencies": {
43
43
  "@commitlint/cli": "16.2.1",
44
44
  "@commitlint/config-angular": "16.2.1",
45
- "eslint": "8.9.0",
45
+ "eslint": "8.10.0",
46
46
  "eslint-config-airbnb-base": "15.0.0",
47
47
  "eslint-plugin-import": "2.25.4",
48
48
  "husky": "7.0.4",
49
- "lint-staged": "12.3.4"
49
+ "lint-staged": "12.3.5"
50
50
  }
51
51
  }
package/plugin.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "modules": {
17
17
  "highlight.js": "../@highlightjs/cdn-assets/highlight.min.js",
18
18
  "highlightjs-line-numbers.js": "./public/js/highlightjs-line-numbers.js",
19
- "admin/plugins/markdown.js": "./public/js/admin.js"
19
+ "../admin/plugins/markdown.js": "./public/js/admin.js"
20
20
  },
21
21
  "languages": "public/languages",
22
22
  "defaultLang": "en_GB",
@@ -1,11 +1,11 @@
1
- {
2
- "bold": "Fettschrift",
3
- "italic": "Kursivschrift",
4
- "list_item": "Listenpunkt",
5
- "strikethrough_text": "Durchgestrichen",
6
- "link_text": "Link Text",
7
- "link_url": "Link Adresse",
8
- "picture_text": "Bild Text",
9
- "picture_url": "Bild Link",
10
- "help_text": "Dieses Forum unterstützt Markdown. Für mehr Informationen, [hier klicken](http://commonmark.org/help/)"
11
- }
1
+ {
2
+ "bold": "Fettschrift",
3
+ "italic": "Kursivschrift",
4
+ "list_item": "Listenpunkt",
5
+ "strikethrough_text": "Durchgestrichen",
6
+ "link_text": "Link Text",
7
+ "link_url": "Link Adresse",
8
+ "picture_text": "Bild Text",
9
+ "picture_url": "Bild Link",
10
+ "help_text": "Dieses Forum unterstützt Markdown. Für mehr Informationen, [hier klicken](http://commonmark.org/help/)"
11
+ }
@@ -1,12 +1,12 @@
1
- {
2
- "bold": "bolded text",
3
- "italic": "italicised text",
4
- "list_item": "list item",
5
- "strikethrough_text": "strikethrough text",
6
- "code_text": "code_text",
7
- "link_text": "link text",
8
- "link_url": "link url",
9
- "picture_text": "alt text",
10
- "picture_url": "image url",
11
- "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
+ "strikethrough_text": "strikethrough text",
6
+ "code_text": "code_text",
7
+ "link_text": "link text",
8
+ "link_url": "link url",
9
+ "picture_text": "alt text",
10
+ "picture_url": "image url",
11
+ "help_text": "This forum is powered by Markdown. For full documentation, [click here](http://commonmark.org/help/)"
12
12
  }
@@ -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
+ }
@@ -1,59 +1,59 @@
1
- .markdown-highlight {
2
- margin-top: 1rem;
3
- color: inherit;
4
- background-color: inherit;
5
- border: none;
6
-
7
- code[data-lines="1"] {
8
- white-space: normal !important;
9
- }
10
-
11
- .hljs-ln-line {
12
- white-space: pre;
13
- }
14
-
15
- .hljs-ln-numbers {
16
- -webkit-touch-callout: none;
17
- -webkit-user-select: none;
18
- -khtml-user-select: none;
19
- -moz-user-select: none;
20
- -ms-user-select: none;
21
- user-select: none;
22
-
23
- text-align: right;
24
- color: #ccc;
25
- border-right: 1px solid #CCC;
26
- vertical-align: top;
27
- padding-right: 5px;
28
- }
29
-
30
- .hljs-ln-code {
31
- padding-left: 5px;
32
- }
33
- }
34
-
35
- // Backwards compatibility with themes without components
36
- .post-content pre, .topic-text pre, .composer .preview pre {
37
- .markdown-highlight;
38
- }
39
-
40
- .markdown-highlight .hljs {
41
- display: inline-block;
42
- }
43
-
44
- [component="post/content"], .composer-container .preview {
45
- div.plugin-markdown {
46
- display: flex;
47
-
48
- input[type="checkbox"] {
49
- margin-right: 0.5rem;
50
- position: relative;
51
- top: 1px;
52
-
53
- &+label {
54
- font-weight: unset;
55
- flex: 1;
56
- }
57
- }
58
- }
1
+ .markdown-highlight {
2
+ margin-top: 1rem;
3
+ color: inherit;
4
+ background-color: inherit;
5
+ border: none;
6
+
7
+ code[data-lines="1"] {
8
+ white-space: normal !important;
9
+ }
10
+
11
+ .hljs-ln-line {
12
+ white-space: pre;
13
+ }
14
+
15
+ .hljs-ln-numbers {
16
+ -webkit-touch-callout: none;
17
+ -webkit-user-select: none;
18
+ -khtml-user-select: none;
19
+ -moz-user-select: none;
20
+ -ms-user-select: none;
21
+ user-select: none;
22
+
23
+ text-align: right;
24
+ color: #ccc;
25
+ border-right: 1px solid #CCC;
26
+ vertical-align: top;
27
+ padding-right: 5px;
28
+ }
29
+
30
+ .hljs-ln-code {
31
+ padding-left: 5px;
32
+ }
33
+ }
34
+
35
+ // Backwards compatibility with themes without components
36
+ .post-content pre, .topic-text pre, .composer .preview pre {
37
+ .markdown-highlight;
38
+ }
39
+
40
+ .markdown-highlight .hljs {
41
+ display: inline-block;
42
+ }
43
+
44
+ [component="post/content"], .composer-container .preview {
45
+ div.plugin-markdown {
46
+ display: flex;
47
+
48
+ input[type="checkbox"] {
49
+ margin-right: 0.5rem;
50
+ position: relative;
51
+ top: 1px;
52
+
53
+ &+label {
54
+ font-weight: unset;
55
+ flex: 1;
56
+ }
57
+ }
58
+ }
59
59
  }