nodebb-plugin-markdown 12.2.6 → 13.0.0-pre.2

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
@@ -10,6 +10,7 @@ const nconf = require.main.require('nconf');
10
10
  const winston = require.main.require('winston');
11
11
  const meta = require.main.require('./src/meta');
12
12
  const posts = require.main.require('./src/posts');
13
+ const activitypub = require.main.require('./src/activitypub');
13
14
  const translator = require.main.require('./src/translator');
14
15
  const plugins = require.main.require('./src/plugins');
15
16
  const cacheCreate = require.main.require('./src/cacheCreate');
@@ -150,7 +151,7 @@ const Markdown = {
150
151
 
151
152
  parsePost: async function (data) {
152
153
  const env = await Markdown.beforeParse(data);
153
- if (data && data.postData && data.postData.content && parser) {
154
+ if (env.parse && data && data.postData && data.postData.content && parser) {
154
155
  data.postData.content = parser.render(data.postData.content, env || {});
155
156
  }
156
157
  return Markdown.afterParse(data);
@@ -176,9 +177,15 @@ const Markdown = {
176
177
 
177
178
  beforeParse: async (data) => {
178
179
  const env = {
180
+ parse: true,
179
181
  images: new Map(),
180
182
  };
181
183
 
184
+ if (activitypub.helpers.isUri(data.postData.pid) && !data.postData.hasOwnProperty('sourceContent')) {
185
+ // content contained is likely already html, bypass parsing
186
+ env.parse = false;
187
+ }
188
+
182
189
  if (data && data.postData && data.postData.pid) {
183
190
  // Check that pid for images, and return their sizes
184
191
  const images = await posts.uploads.listWithSizes(data.postData.pid);
package/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "nodebb-plugin-markdown",
3
- "version": "12.2.6",
3
+ "version": "13.0.0-pre.2",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "nodebb-plugin-markdown",
9
- "version": "12.2.6",
9
+ "version": "13.0.0-pre.2",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "highlight.js": "11.4.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-markdown",
3
- "version": "12.2.6",
3
+ "version": "13.0.0-pre.2",
4
4
  "description": "A Markdown parser for NodeBB",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -37,7 +37,7 @@
37
37
  "probe-image-size": "^7.2.1"
38
38
  },
39
39
  "nbbpm": {
40
- "compatibility": "^3.0.0"
40
+ "compatibility": "^4.0.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@commitlint/cli": "16.2.1",