nodebb-plugin-markdown 8.14.3 → 9.0.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.
@@ -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,50 +1,51 @@
1
- {
2
- "name": "nodebb-plugin-markdown",
3
- "version": "8.14.3",
4
- "description": "A Markdown parser for NodeBB",
5
- "main": "index.js",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/julianlam/nodebb-plugin-markdown"
9
- },
10
- "keywords": [
11
- "nodebb",
12
- "plugin",
13
- "markdown"
14
- ],
15
- "author": "Julian Lam <julian@designcreateplay.com>",
16
- "license": "MIT",
17
- "bugs": {
18
- "url": "https://github.com/julianlam/nodebb-plugin-markdown/issues"
19
- },
20
- "husky": {
21
- "hooks": {
22
- "pre-commit": "lint-staged",
23
- "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
24
- }
25
- },
26
- "lint-staged": {
27
- "*.js": [
28
- "eslint --fix"
29
- ]
30
- },
31
- "dependencies": {
32
- "highlight.js": "10.4.1",
33
- "markdown-it": "^12.0.6",
34
- "markdown-it-checkbox": "^1.1.0",
35
- "markdown-it-multimd-table": "^4.0.1",
36
- "probe-image-size": "^7.2.1"
37
- },
38
- "nbbpm": {
39
- "compatibility": "^1.17.0"
40
- },
41
- "devDependencies": {
42
- "@commitlint/cli": "^12.1.4",
43
- "@commitlint/config-angular": "^12.1.4",
44
- "eslint": "^7.27.0",
45
- "eslint-config-airbnb-base": "^14.2.1",
46
- "eslint-plugin-import": "^2.23.3",
47
- "husky": "^4.3.8",
48
- "lint-staged": "^10.5.4"
49
- }
50
- }
1
+ {
2
+ "name": "nodebb-plugin-markdown",
3
+ "version": "9.0.0",
4
+ "description": "A Markdown parser for NodeBB",
5
+ "main": "index.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/julianlam/nodebb-plugin-markdown"
9
+ },
10
+ "keywords": [
11
+ "nodebb",
12
+ "plugin",
13
+ "markdown"
14
+ ],
15
+ "author": "Julian Lam <julian@designcreateplay.com>",
16
+ "license": "MIT",
17
+ "bugs": {
18
+ "url": "https://github.com/julianlam/nodebb-plugin-markdown/issues"
19
+ },
20
+ "husky": {
21
+ "hooks": {
22
+ "pre-commit": "lint-staged",
23
+ "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
24
+ }
25
+ },
26
+ "lint-staged": {
27
+ "*.js": [
28
+ "eslint --fix"
29
+ ]
30
+ },
31
+ "dependencies": {
32
+ "@highlightjs/cdn-assets": "^11.4.0",
33
+ "highlightjs-line-numbers.js": "^2.8.0",
34
+ "markdown-it": "^12.0.6",
35
+ "markdown-it-checkbox": "^1.1.0",
36
+ "markdown-it-multimd-table": "^4.0.1",
37
+ "probe-image-size": "^7.2.1"
38
+ },
39
+ "nbbpm": {
40
+ "compatibility": "^1.17.0"
41
+ },
42
+ "devDependencies": {
43
+ "@commitlint/cli": "16.1.0",
44
+ "@commitlint/config-angular": "16.0.0",
45
+ "eslint": "8.8.0",
46
+ "eslint-config-airbnb-base": "15.0.0",
47
+ "eslint-plugin-import": "2.25.4",
48
+ "husky": "7.0.4",
49
+ "lint-staged": "12.3.2"
50
+ }
51
+ }
package/plugin.json CHANGED
@@ -1,41 +1,40 @@
1
- {
2
- "id": "nodebb-plugin-markdown",
3
- "name": "Markdown Parser",
4
- "description": "A Markdown parser for NodeBB",
5
- "url": "https://github.com/julianlam/nodebb-plugin-markdown",
6
- "library": "./index.js",
7
- "less": [
8
- "public/less/default.less"
9
- ],
10
- "scripts": [
11
- "public/js/client.js"
12
- ],
13
- "acpScripts": [
14
- "public/js/admin.js"
15
- ],
16
- "staticDirs": {
17
- "styles": "../highlight.js/styles",
18
- "js": "public/js"
19
- },
20
- "modules": [
21
- "./public/js/highlight.js",
22
- "./public/js/highlightjs-line-numbers.js"
23
- ],
24
- "languages": "public/languages",
25
- "defaultLang": "en_GB",
26
- "templates": "./public/templates",
27
- "settingsRoute": "/admin/plugins/markdown",
28
- "hooks": [
29
- { "hook": "static:app.load", "method": "onLoad" },
30
- { "hook": "filter:parse.post", "method": "parsePost", "priority": 5 },
31
- { "hook": "filter:parse.signature", "method": "parseSignature", "priority": 5 },
32
- { "hook": "filter:parse.aboutme", "method": "parseAboutMe"},
33
- { "hook": "filter:parse.raw", "method": "parseRaw", "priority": 5 },
34
- { "hook": "filter:composer.help", "method": "renderHelp" },
35
- { "hook": "filter:admin.header.build", "method": "admin.menu" },
36
- { "hook": "filter:composer.formatting", "method": "registerFormatting" },
37
- { "hook": "filter:config.get", "method": "getConfig" },
38
- { "hook": "filter:meta.getLinkTags", "method": "getLinkTags"},
39
- { "hook": "filter:sanitize.config", "method": "updateSanitizeConfig" }
40
- ]
41
- }
1
+ {
2
+ "id": "nodebb-plugin-markdown",
3
+ "name": "Markdown Parser",
4
+ "description": "A Markdown parser for NodeBB",
5
+ "url": "https://github.com/julianlam/nodebb-plugin-markdown",
6
+ "library": "./index.js",
7
+ "less": [
8
+ "public/less/default.less"
9
+ ],
10
+ "scripts": [
11
+ "public/js/client.js"
12
+ ],
13
+ "acpScripts": [
14
+ "public/js/admin.js"
15
+ ],
16
+ "staticDirs": {
17
+ "js": "public/js"
18
+ },
19
+ "modules": {
20
+ "highlight.js": "./node_modules/@highlightjs/cdn-assets/highlight.min.js",
21
+ "highlightjs-line-numbers.js": "./public/js/highlightjs-line-numbers.js"
22
+ },
23
+ "languages": "public/languages",
24
+ "defaultLang": "en_GB",
25
+ "templates": "./public/templates",
26
+ "settingsRoute": "/admin/plugins/markdown",
27
+ "hooks": [
28
+ { "hook": "static:app.load", "method": "onLoad" },
29
+ { "hook": "filter:parse.post", "method": "parsePost", "priority": 5 },
30
+ { "hook": "filter:parse.signature", "method": "parseSignature", "priority": 5 },
31
+ { "hook": "filter:parse.aboutme", "method": "parseAboutMe"},
32
+ { "hook": "filter:parse.raw", "method": "parseRaw", "priority": 5 },
33
+ { "hook": "filter:composer.help", "method": "renderHelp" },
34
+ { "hook": "filter:admin.header.build", "method": "admin.menu" },
35
+ { "hook": "filter:composer.formatting", "method": "registerFormatting" },
36
+ { "hook": "filter:config.get", "method": "getConfig" },
37
+ { "hook": "filter:meta.getLinkTags", "method": "getLinkTags"},
38
+ { "hook": "filter:sanitize.config", "method": "updateSanitizeConfig" }
39
+ ]
40
+ }
@@ -1,76 +1,76 @@
1
- 'use strict';
2
-
3
- /* globals define, $, app, socket, bootbox */
4
-
5
- define('admin/plugins/markdown', ['settings'], function (Settings) {
6
- var Markdown = {};
7
-
8
- Markdown.init = function () {
9
- Settings.load('markdown', $('.markdown-settings'), function (err, settings) {
10
- if (err) {
11
- settings = {};
12
- }
13
-
14
- var defaults = {
15
- html: false,
16
-
17
- langPrefix: 'language-',
18
- highlight: true,
19
- highlightLinesLanguageList: [],
20
- highlightTheme: 'railscasts.css',
21
-
22
- probe: true,
23
- probeCacheSize: 256,
24
-
25
- xhtmlOut: true,
26
- breaks: true,
27
- linkify: true,
28
- typographer: false,
29
- externalBlank: false,
30
- nofollow: true,
31
- allowRTLO: false,
32
- checkboxes: true,
33
- multimdTables: true,
34
- };
35
-
36
- // Set defaults
37
- for (var setting in defaults) {
38
- if (!settings.hasOwnProperty(setting)) {
39
- if (typeof defaults[setting] === 'boolean') {
40
- $('#' + setting).prop('checked', defaults[setting]);
41
- } else {
42
- $('#' + setting).val(defaults[setting]);
43
- }
44
- }
45
- }
46
- });
47
-
48
- $('#save').on('click', function () {
49
- Settings.save('markdown', $('.markdown-settings'), function () {
50
- app.alert({
51
- type: 'success',
52
- alert_id: 'markdown-saved',
53
- title: 'Reload Required',
54
- message: 'Please reload your NodeBB to have your changes take effect',
55
- clickfn: function () {
56
- socket.emit('admin.reload');
57
- },
58
- });
59
- });
60
- });
61
-
62
- // Warning for "html" option
63
- $('#html').on('change', function () {
64
- var inputEl = $(this);
65
- if (inputEl.prop('checked')) {
66
- bootbox.confirm('Are you sure you wish to disable sanitisation of HTML? <strong>Doing so compromises your forum&apos;s client-side security, and allows malicious users to execute arbitrary javascript on other users&apos; browsers.</strong>', function (result) {
67
- if (!result) {
68
- inputEl.prop('checked', false);
69
- }
70
- });
71
- }
72
- });
73
- };
74
-
75
- return Markdown;
76
- });
1
+ 'use strict';
2
+
3
+ /* globals define, $, socket, bootbox */
4
+
5
+ define('admin/plugins/markdown', ['settings', 'alerts'], function (Settings, alerts) {
6
+ var Markdown = {};
7
+
8
+ Markdown.init = function () {
9
+ Settings.load('markdown', $('.markdown-settings'), function (err, settings) {
10
+ if (err) {
11
+ settings = {};
12
+ }
13
+
14
+ var defaults = {
15
+ html: false,
16
+
17
+ langPrefix: 'language-',
18
+ highlight: true,
19
+ highlightLinesLanguageList: [],
20
+ highlightTheme: 'default.min.css',
21
+
22
+ probe: true,
23
+ probeCacheSize: 256,
24
+
25
+ xhtmlOut: true,
26
+ breaks: true,
27
+ linkify: true,
28
+ typographer: false,
29
+ externalBlank: false,
30
+ nofollow: true,
31
+ allowRTLO: false,
32
+ checkboxes: true,
33
+ multimdTables: true,
34
+ };
35
+
36
+ // Set defaults
37
+ for (var setting in defaults) {
38
+ if (!settings.hasOwnProperty(setting)) {
39
+ if (typeof defaults[setting] === 'boolean') {
40
+ $('#' + setting).prop('checked', defaults[setting]);
41
+ } else {
42
+ $('#' + setting).val(defaults[setting]);
43
+ }
44
+ }
45
+ }
46
+ });
47
+
48
+ $('#save').on('click', function () {
49
+ Settings.save('markdown', $('.markdown-settings'), function () {
50
+ alerts.alert({
51
+ type: 'success',
52
+ alert_id: 'markdown-saved',
53
+ title: 'Reload Required',
54
+ message: 'Please reload your NodeBB to have your changes take effect',
55
+ clickfn: function () {
56
+ socket.emit('admin.reload');
57
+ },
58
+ });
59
+ });
60
+ });
61
+
62
+ // Warning for "html" option
63
+ $('#html').on('change', function () {
64
+ var inputEl = $(this);
65
+ if (inputEl.prop('checked')) {
66
+ bootbox.confirm('Are you sure you wish to disable sanitisation of HTML? <strong>Doing so compromises your forum&apos;s client-side security, and allows malicious users to execute arbitrary javascript on other users&apos; browsers.</strong>', function (result) {
67
+ if (!result) {
68
+ inputEl.prop('checked', false);
69
+ }
70
+ });
71
+ }
72
+ });
73
+ };
74
+
75
+ return Markdown;
76
+ });