nodebb-plugin-markdown 12.0.1 → 12.0.3
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 +4 -2
- package/package.json +1 -1
- package/public/js/client.js +2 -1
- package/public/templates/modals/markdown-help.tpl +123 -0
package/index.js
CHANGED
|
@@ -19,12 +19,13 @@ const SocketPlugins = require.main.require('./src/socket.io/plugins');
|
|
|
19
19
|
SocketPlugins.markdown = require('./websockets');
|
|
20
20
|
|
|
21
21
|
let parser;
|
|
22
|
-
|
|
22
|
+
let app;
|
|
23
23
|
const Markdown = {
|
|
24
24
|
config: {},
|
|
25
25
|
_externalImageCache: undefined,
|
|
26
26
|
_externalImageFailures: new Set(),
|
|
27
27
|
onLoad: async function (params) {
|
|
28
|
+
app = params.app;
|
|
28
29
|
const controllers = require('./lib/controllers');
|
|
29
30
|
const hostMiddleware = require.main.require('./src/middleware');
|
|
30
31
|
const middlewares = [
|
|
@@ -266,7 +267,8 @@ const Markdown = {
|
|
|
266
267
|
renderHelp: async function (helpContent) {
|
|
267
268
|
const translated = await translator.translate('[[markdown:help_text]]');
|
|
268
269
|
const parsed = await plugins.hooks.fire('filter:parse.raw', `## Markdown\n${translated}`);
|
|
269
|
-
|
|
270
|
+
const html = await app.renderAsync('modals/markdown-help', {});
|
|
271
|
+
helpContent += parsed + html;
|
|
270
272
|
return helpContent;
|
|
271
273
|
},
|
|
272
274
|
|
package/package.json
CHANGED
package/public/js/client.js
CHANGED
|
@@ -311,7 +311,8 @@
|
|
|
311
311
|
for(className of classIterator) {
|
|
312
312
|
if (className.startsWith('language-')) {
|
|
313
313
|
const language = className.split('-')[1];
|
|
314
|
-
|
|
314
|
+
const list = config.markdown.highlightLinesLanguageList;
|
|
315
|
+
if (aliasMap.has(language) && list && list.includes(aliasMap.get(language))) {
|
|
315
316
|
$(block).attr('data-lines', 1);
|
|
316
317
|
window.hljs.lineNumbersBlock(block);
|
|
317
318
|
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<table class="table markdown-reference">
|
|
2
|
+
<thead>
|
|
3
|
+
<tr>
|
|
4
|
+
<th>Type</th>
|
|
5
|
+
<th>… to Get</th>
|
|
6
|
+
</tr>
|
|
7
|
+
</thead>
|
|
8
|
+
<tbody>
|
|
9
|
+
<tr>
|
|
10
|
+
<td class="preformatted">*Italic*</td>
|
|
11
|
+
<td><em>Italic</em></td>
|
|
12
|
+
</tr>
|
|
13
|
+
<tr>
|
|
14
|
+
<td class="preformatted">**Bold**</td>
|
|
15
|
+
<td><strong>Bold</strong></td>
|
|
16
|
+
</tr>
|
|
17
|
+
<tr>
|
|
18
|
+
<td class="preformatted">
|
|
19
|
+
# Heading 1
|
|
20
|
+
</td>
|
|
21
|
+
<td>
|
|
22
|
+
<h1 class="smaller-h1">Heading 1</h1>
|
|
23
|
+
</td>
|
|
24
|
+
</tr>
|
|
25
|
+
<tr>
|
|
26
|
+
<td class="preformatted">
|
|
27
|
+
## Heading 2
|
|
28
|
+
</td>
|
|
29
|
+
<td>
|
|
30
|
+
<h2 class="smaller-h2">Heading 2</h2>
|
|
31
|
+
</td>
|
|
32
|
+
</tr>
|
|
33
|
+
<tr>
|
|
34
|
+
<td class="preformatted">
|
|
35
|
+
[Link](http://a.com)
|
|
36
|
+
</td>
|
|
37
|
+
<td><a href="https://commonmark.org/">Link</a></td>
|
|
38
|
+
</tr>
|
|
39
|
+
<tr>
|
|
40
|
+
<td class="preformatted">
|
|
41
|
+

|
|
42
|
+
</td>
|
|
43
|
+
<td>
|
|
44
|
+
<img src="/assets/logo.png" width="auto" height="36" alt="NodeBB Logo">
|
|
45
|
+
</td>
|
|
46
|
+
</tr>
|
|
47
|
+
<tr>
|
|
48
|
+
<td class="preformatted">
|
|
49
|
+
> Blockquote
|
|
50
|
+
</td>
|
|
51
|
+
<td>
|
|
52
|
+
<blockquote>Blockquote</blockquote>
|
|
53
|
+
</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr>
|
|
56
|
+
<td class="preformatted">
|
|
57
|
+
<p>
|
|
58
|
+
* List<br>
|
|
59
|
+
* List<br>
|
|
60
|
+
* List
|
|
61
|
+
</p>
|
|
62
|
+
</td>
|
|
63
|
+
<td>
|
|
64
|
+
<ul>
|
|
65
|
+
<li>List</li>
|
|
66
|
+
<li>List</li>
|
|
67
|
+
<li>List</li>
|
|
68
|
+
</ul>
|
|
69
|
+
</td>
|
|
70
|
+
</tr>
|
|
71
|
+
<tr>
|
|
72
|
+
<td class="preformatted">
|
|
73
|
+
<p>
|
|
74
|
+
1. One<br>
|
|
75
|
+
2. Two<br>
|
|
76
|
+
3. Three
|
|
77
|
+
</p>
|
|
78
|
+
</td>
|
|
79
|
+
<td>
|
|
80
|
+
<ol>
|
|
81
|
+
<li>One</li>
|
|
82
|
+
<li>Two</li>
|
|
83
|
+
<li>Three</li>
|
|
84
|
+
</ol>
|
|
85
|
+
</td>
|
|
86
|
+
</tr>
|
|
87
|
+
<tr>
|
|
88
|
+
<td class="preformatted">
|
|
89
|
+
Horizontal rule:<br>
|
|
90
|
+
<br>
|
|
91
|
+
---
|
|
92
|
+
</td>
|
|
93
|
+
<td>
|
|
94
|
+
Horizontal rule:
|
|
95
|
+
<hr class="custom-hr">
|
|
96
|
+
</td>
|
|
97
|
+
</tr>
|
|
98
|
+
<tr>
|
|
99
|
+
<td class="preformatted">
|
|
100
|
+
`Inline code` with backticks
|
|
101
|
+
</td>
|
|
102
|
+
<td>
|
|
103
|
+
<code class="preformatted">Inline code</code> with backticks
|
|
104
|
+
</td>
|
|
105
|
+
</tr>
|
|
106
|
+
<tr>
|
|
107
|
+
<td class="preformatted">
|
|
108
|
+
```<br>
|
|
109
|
+
# code block<br>
|
|
110
|
+
print '3 backticks or'<br>
|
|
111
|
+
print 'indent 4 spaces'<br>
|
|
112
|
+
```
|
|
113
|
+
</td>
|
|
114
|
+
<td>
|
|
115
|
+
<pre class="code-block text-nowrap">
|
|
116
|
+
# code block
|
|
117
|
+
<br> print '3 backticks or'
|
|
118
|
+
<br> print 'indent 4 spaces'
|
|
119
|
+
</pre>
|
|
120
|
+
</td>
|
|
121
|
+
</tr>
|
|
122
|
+
</tbody>
|
|
123
|
+
</table>
|