nodebb-plugin-markdown 13.0.0-pre.9 → 13.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 +10 -9
- package/package-lock.json +2161 -775
- package/package.json +2 -2
- package/public/languages/de/markdown.json +1 -1
- package/public/languages/en-GB/markdown.json +1 -1
- package/public/languages/fr/markdown.json +1 -1
- package/public/languages/pl/markdown.json +1 -1
- package/public/languages/ru/markdown.json +1 -1
- package/public/languages/tr/markdown.json +1 -1
- package/public/templates/modals/markdown-help.tpl +3 -0
package/index.js
CHANGED
|
@@ -8,7 +8,6 @@ const nconf = require.main.require('nconf');
|
|
|
8
8
|
const winston = require.main.require('winston');
|
|
9
9
|
const meta = require.main.require('./src/meta');
|
|
10
10
|
const activitypub = require.main.require('./src/activitypub');
|
|
11
|
-
const translator = require.main.require('./src/translator');
|
|
12
11
|
const plugins = require.main.require('./src/plugins');
|
|
13
12
|
|
|
14
13
|
const SocketPlugins = require.main.require('./src/socket.io/plugins');
|
|
@@ -167,12 +166,16 @@ const Markdown = {
|
|
|
167
166
|
|
|
168
167
|
({ env } = await plugins.hooks.fire('filter:markdown.beforeParse', { env, data: Object.freeze({ ...data }) }));
|
|
169
168
|
|
|
170
|
-
if (
|
|
171
|
-
activitypub.helpers.isUri(data.postData.pid) &&
|
|
172
|
-
(!data.postData.hasOwnProperty('sourceContent') || !data.postData.sourceContent)
|
|
173
|
-
) {
|
|
174
|
-
// content contained is likely already html, bypass parsing
|
|
169
|
+
if (data.type === 'markdown') {
|
|
175
170
|
env.parse = false;
|
|
171
|
+
} else if (activitypub.helpers.isUri(data.postData.pid)) {
|
|
172
|
+
if (data.postData.sourceContent) {
|
|
173
|
+
data.content = data.sourceContent;
|
|
174
|
+
delete data.sourceContent;
|
|
175
|
+
} else {
|
|
176
|
+
// content contained is likely already html, bypass parsing
|
|
177
|
+
env.parse = false;
|
|
178
|
+
}
|
|
176
179
|
}
|
|
177
180
|
|
|
178
181
|
return env;
|
|
@@ -207,10 +210,8 @@ const Markdown = {
|
|
|
207
210
|
},
|
|
208
211
|
|
|
209
212
|
renderHelp: async function (helpContent) {
|
|
210
|
-
const translated = await translator.translate('[[markdown:help-text]]');
|
|
211
|
-
const parsed = await plugins.hooks.fire('filter:parse.raw', `## Markdown\n${translated}`);
|
|
212
213
|
const html = await app.renderAsync('modals/markdown-help', {});
|
|
213
|
-
helpContent +=
|
|
214
|
+
helpContent += html;
|
|
214
215
|
return helpContent;
|
|
215
216
|
},
|
|
216
217
|
|