nodebb-plugin-markdown 8.14.5 → 9.0.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/.eslintignore +1 -1
- package/.eslintrc +128 -128
- package/.jshintrc +85 -85
- package/README.md +9 -9
- package/index.js +25 -26
- package/lib/controllers.js +32 -32
- package/package.json +8 -7
- package/plugin.json +8 -6
- package/public/js/admin.js +1 -1
- package/public/js/client.js +251 -246
- package/public/js/highlightjs-line-numbers.js +372 -189
- package/public/languages/de/markdown.json +11 -11
- package/public/languages/en-GB/markdown.json +11 -11
- package/public/languages/fa-IR/markdown.json +11 -11
- package/public/languages/fr/markdown.json +11 -11
- package/public/languages/he/markdown.json +12 -12
- package/public/languages/pl/markdown.json +11 -11
- package/public/languages/tr/markdown.json +11 -11
- package/public/languages/zh-CN/markdown.json +11 -11
- package/public/less/default.less +58 -58
- package/public/templates/admin/plugins/markdown.tpl +13 -3
- package/upgrades/reset_md_hljs_theme.js +20 -0
- package/public/js/highlight.js +0 -2
|
@@ -1,190 +1,373 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* STOP! This file was edited from the version found in the repo
|
|
3
|
-
* https://github.com/wcoder/highlightjs-line-numbers.js
|
|
4
|
-
*
|
|
5
|
-
* Changes:
|
|
6
|
-
* - Made into a requirejs module
|
|
7
|
-
* - Instead of passing window, document in as w and d, they
|
|
8
|
-
* are defined at top of module
|
|
9
|
-
*/
|
|
10
|
-
define('highlightjs-line-numbers', ['highlight'], function () {
|
|
11
|
-
var w = window;
|
|
12
|
-
var d = document;
|
|
13
|
-
|
|
14
|
-
var TABLE_NAME = 'hljs-ln',
|
|
15
|
-
LINE_NAME = 'hljs-ln-line',
|
|
16
|
-
CODE_BLOCK_NAME = 'hljs-ln-code',
|
|
17
|
-
NUMBERS_BLOCK_NAME = 'hljs-ln-numbers',
|
|
18
|
-
NUMBER_LINE_NAME = 'hljs-ln-n',
|
|
19
|
-
DATA_ATTR_NAME = 'data-line-number',
|
|
20
|
-
BREAK_LINE_REGEXP = /\r\n|\r|\n/g;
|
|
21
|
-
|
|
22
|
-
if (w.hljs) {
|
|
23
|
-
w.hljs.initLineNumbersOnLoad = initLineNumbersOnLoad;
|
|
24
|
-
w.hljs.lineNumbersBlock = lineNumbersBlock;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
'
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
1
|
+
/**
|
|
2
|
+
* STOP! This file was edited from the version found in the repo
|
|
3
|
+
* https://github.com/wcoder/highlightjs-line-numbers.js
|
|
4
|
+
*
|
|
5
|
+
* Changes:
|
|
6
|
+
* - Made into a requirejs module
|
|
7
|
+
* - Instead of passing window, document in as w and d, they
|
|
8
|
+
* are defined at top of module
|
|
9
|
+
*/
|
|
10
|
+
define('highlightjs-line-numbers', ['highlight'], function () {
|
|
11
|
+
var w = window;
|
|
12
|
+
var d = document;
|
|
13
|
+
|
|
14
|
+
var TABLE_NAME = 'hljs-ln',
|
|
15
|
+
LINE_NAME = 'hljs-ln-line',
|
|
16
|
+
CODE_BLOCK_NAME = 'hljs-ln-code',
|
|
17
|
+
NUMBERS_BLOCK_NAME = 'hljs-ln-numbers',
|
|
18
|
+
NUMBER_LINE_NAME = 'hljs-ln-n',
|
|
19
|
+
DATA_ATTR_NAME = 'data-line-number',
|
|
20
|
+
BREAK_LINE_REGEXP = /\r\n|\r|\n/g;
|
|
21
|
+
|
|
22
|
+
if (w.hljs) {
|
|
23
|
+
w.hljs.initLineNumbersOnLoad = initLineNumbersOnLoad;
|
|
24
|
+
w.hljs.lineNumbersBlock = lineNumbersBlock;
|
|
25
|
+
w.hljs.lineNumbersValue = lineNumbersValue;
|
|
26
|
+
|
|
27
|
+
addStyles();
|
|
28
|
+
} else {
|
|
29
|
+
w.console.error('highlight.js not detected!');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function isHljsLnCodeDescendant(domElt) {
|
|
33
|
+
var curElt = domElt;
|
|
34
|
+
while (curElt) {
|
|
35
|
+
if (curElt.className && curElt.className.indexOf('hljs-ln-code') !== -1) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
curElt = curElt.parentNode;
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function getHljsLnTable(hljsLnDomElt) {
|
|
44
|
+
var curElt = hljsLnDomElt;
|
|
45
|
+
while (curElt.nodeName !== 'TABLE') {
|
|
46
|
+
curElt = curElt.parentNode;
|
|
47
|
+
}
|
|
48
|
+
return curElt;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Function to workaround a copy issue with Microsoft Edge.
|
|
52
|
+
// Due to hljs-ln wrapping the lines of code inside a <table> element,
|
|
53
|
+
// itself wrapped inside a <pre> element, window.getSelection().toString()
|
|
54
|
+
// does not contain any line breaks. So we need to get them back using the
|
|
55
|
+
// rendered code in the DOM as reference.
|
|
56
|
+
function edgeGetSelectedCodeLines(selection) {
|
|
57
|
+
// current selected text without line breaks
|
|
58
|
+
var selectionText = selection.toString();
|
|
59
|
+
|
|
60
|
+
// get the <td> element wrapping the first line of selected code
|
|
61
|
+
var tdAnchor = selection.anchorNode;
|
|
62
|
+
while (tdAnchor.nodeName !== 'TD') {
|
|
63
|
+
tdAnchor = tdAnchor.parentNode;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// get the <td> element wrapping the last line of selected code
|
|
67
|
+
var tdFocus = selection.focusNode;
|
|
68
|
+
while (tdFocus.nodeName !== 'TD') {
|
|
69
|
+
tdFocus = tdFocus.parentNode;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// extract line numbers
|
|
73
|
+
var firstLineNumber = parseInt(tdAnchor.dataset.lineNumber);
|
|
74
|
+
var lastLineNumber = parseInt(tdFocus.dataset.lineNumber);
|
|
75
|
+
|
|
76
|
+
// multi-lines copied case
|
|
77
|
+
if (firstLineNumber != lastLineNumber) {
|
|
78
|
+
|
|
79
|
+
var firstLineText = tdAnchor.textContent;
|
|
80
|
+
var lastLineText = tdFocus.textContent;
|
|
81
|
+
|
|
82
|
+
// if the selection was made backward, swap values
|
|
83
|
+
if (firstLineNumber > lastLineNumber) {
|
|
84
|
+
var tmp = firstLineNumber;
|
|
85
|
+
firstLineNumber = lastLineNumber;
|
|
86
|
+
lastLineNumber = tmp;
|
|
87
|
+
tmp = firstLineText;
|
|
88
|
+
firstLineText = lastLineText;
|
|
89
|
+
lastLineText = tmp;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// discard not copied characters in first line
|
|
93
|
+
while (selectionText.indexOf(firstLineText) !== 0) {
|
|
94
|
+
firstLineText = firstLineText.slice(1);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// discard not copied characters in last line
|
|
98
|
+
while (selectionText.lastIndexOf(lastLineText) === -1) {
|
|
99
|
+
lastLineText = lastLineText.slice(0, -1);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// reconstruct and return the real copied text
|
|
103
|
+
var selectedText = firstLineText;
|
|
104
|
+
var hljsLnTable = getHljsLnTable(tdAnchor);
|
|
105
|
+
for (var i = firstLineNumber + 1 ; i < lastLineNumber ; ++i) {
|
|
106
|
+
var codeLineSel = format('.{0}[{1}="{2}"]', [CODE_BLOCK_NAME, DATA_ATTR_NAME, i]);
|
|
107
|
+
var codeLineElt = hljsLnTable.querySelector(codeLineSel);
|
|
108
|
+
selectedText += '\n' + codeLineElt.textContent;
|
|
109
|
+
}
|
|
110
|
+
selectedText += '\n' + lastLineText;
|
|
111
|
+
return selectedText;
|
|
112
|
+
// single copied line case
|
|
113
|
+
} else {
|
|
114
|
+
return selectionText;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// ensure consistent code copy/paste behavior across all browsers
|
|
119
|
+
// (see https://github.com/wcoder/highlightjs-line-numbers.js/issues/51)
|
|
120
|
+
document.addEventListener('copy', function(e) {
|
|
121
|
+
// get current selection
|
|
122
|
+
var selection = window.getSelection();
|
|
123
|
+
// override behavior when one wants to copy line of codes
|
|
124
|
+
if (isHljsLnCodeDescendant(selection.anchorNode)) {
|
|
125
|
+
var selectionText;
|
|
126
|
+
// workaround an issue with Microsoft Edge as copied line breaks
|
|
127
|
+
// are removed otherwise from the selection string
|
|
128
|
+
if (window.navigator.userAgent.indexOf('Edge') !== -1) {
|
|
129
|
+
selectionText = edgeGetSelectedCodeLines(selection);
|
|
130
|
+
} else {
|
|
131
|
+
// other browsers can directly use the selection string
|
|
132
|
+
selectionText = selection.toString();
|
|
133
|
+
}
|
|
134
|
+
e.clipboardData.setData('text/plain', selectionText);
|
|
135
|
+
e.preventDefault();
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
function addStyles () {
|
|
140
|
+
var css = d.createElement('style');
|
|
141
|
+
css.type = 'text/css';
|
|
142
|
+
css.innerHTML = format(
|
|
143
|
+
'.{0}{border-collapse:collapse}' +
|
|
144
|
+
'.{0} td{padding:0}' +
|
|
145
|
+
'.{1}:before{content:attr({2})}',
|
|
146
|
+
[
|
|
147
|
+
TABLE_NAME,
|
|
148
|
+
NUMBER_LINE_NAME,
|
|
149
|
+
DATA_ATTR_NAME
|
|
150
|
+
]);
|
|
151
|
+
d.getElementsByTagName('head')[0].appendChild(css);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function initLineNumbersOnLoad (options) {
|
|
155
|
+
if (d.readyState === 'interactive' || d.readyState === 'complete') {
|
|
156
|
+
documentReady(options);
|
|
157
|
+
} else {
|
|
158
|
+
w.addEventListener('DOMContentLoaded', function () {
|
|
159
|
+
documentReady(options);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function documentReady (options) {
|
|
165
|
+
try {
|
|
166
|
+
var blocks = d.querySelectorAll('code.hljs,code.nohighlight');
|
|
167
|
+
|
|
168
|
+
for (var i in blocks) {
|
|
169
|
+
if (blocks.hasOwnProperty(i)) {
|
|
170
|
+
if (!isPluginDisabledForBlock(blocks[i])) {
|
|
171
|
+
lineNumbersBlock(blocks[i], options);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
} catch (e) {
|
|
176
|
+
w.console.error('LineNumbers error: ', e);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function isPluginDisabledForBlock(element) {
|
|
181
|
+
return element.classList.contains('nohljsln');
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function lineNumbersBlock (element, options) {
|
|
185
|
+
if (typeof element !== 'object') return;
|
|
186
|
+
|
|
187
|
+
async(function () {
|
|
188
|
+
element.innerHTML = lineNumbersInternal(element, options);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function lineNumbersValue (value, options) {
|
|
193
|
+
if (typeof value !== 'string') return;
|
|
194
|
+
|
|
195
|
+
var element = document.createElement('code')
|
|
196
|
+
element.innerHTML = value
|
|
197
|
+
|
|
198
|
+
return lineNumbersInternal(element, options);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function lineNumbersInternal (element, options) {
|
|
202
|
+
|
|
203
|
+
var internalOptions = mapOptions(element, options);
|
|
204
|
+
|
|
205
|
+
duplicateMultilineNodes(element);
|
|
206
|
+
|
|
207
|
+
return addLineNumbersBlockFor(element.innerHTML, internalOptions);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function addLineNumbersBlockFor (inputHtml, options) {
|
|
211
|
+
var lines = getLines(inputHtml);
|
|
212
|
+
|
|
213
|
+
// if last line contains only carriage return remove it
|
|
214
|
+
if (lines[lines.length-1].trim() === '') {
|
|
215
|
+
lines.pop();
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (lines.length > 1 || options.singleLine) {
|
|
219
|
+
var html = '';
|
|
220
|
+
|
|
221
|
+
for (var i = 0, l = lines.length; i < l; i++) {
|
|
222
|
+
html += format(
|
|
223
|
+
'<tr>' +
|
|
224
|
+
'<td class="{0} {1}" {3}="{5}">' +
|
|
225
|
+
'<div class="{2}" {3}="{5}"></div>' +
|
|
226
|
+
'</td>' +
|
|
227
|
+
'<td class="{0} {4}" {3}="{5}">' +
|
|
228
|
+
'{6}' +
|
|
229
|
+
'</td>' +
|
|
230
|
+
'</tr>',
|
|
231
|
+
[
|
|
232
|
+
LINE_NAME,
|
|
233
|
+
NUMBERS_BLOCK_NAME,
|
|
234
|
+
NUMBER_LINE_NAME,
|
|
235
|
+
DATA_ATTR_NAME,
|
|
236
|
+
CODE_BLOCK_NAME,
|
|
237
|
+
i + options.startFrom,
|
|
238
|
+
lines[i].length > 0 ? lines[i] : ' '
|
|
239
|
+
]);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return format('<table class="{0}">{1}</table>', [ TABLE_NAME, html ]);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return inputHtml;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* @param {HTMLElement} element Code block.
|
|
250
|
+
* @param {Object} options External API options.
|
|
251
|
+
* @returns {Object} Internal API options.
|
|
252
|
+
*/
|
|
253
|
+
function mapOptions (element, options) {
|
|
254
|
+
options = options || {};
|
|
255
|
+
return {
|
|
256
|
+
singleLine: getSingleLineOption(options),
|
|
257
|
+
startFrom: getStartFromOption(element, options)
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function getSingleLineOption (options) {
|
|
262
|
+
var defaultValue = false;
|
|
263
|
+
if (!!options.singleLine) {
|
|
264
|
+
return options.singleLine;
|
|
265
|
+
}
|
|
266
|
+
return defaultValue;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function getStartFromOption (element, options) {
|
|
270
|
+
var defaultValue = 1;
|
|
271
|
+
var startFrom = defaultValue;
|
|
272
|
+
|
|
273
|
+
if (isFinite(options.startFrom)) {
|
|
274
|
+
startFrom = options.startFrom;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// can be overridden because local option is priority
|
|
278
|
+
var value = getAttribute(element, 'data-ln-start-from');
|
|
279
|
+
if (value !== null) {
|
|
280
|
+
startFrom = toNumber(value, defaultValue);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return startFrom;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Recursive method for fix multi-line elements implementation in highlight.js
|
|
288
|
+
* Doing deep passage on child nodes.
|
|
289
|
+
* @param {HTMLElement} element
|
|
290
|
+
*/
|
|
291
|
+
function duplicateMultilineNodes (element) {
|
|
292
|
+
var nodes = element.childNodes;
|
|
293
|
+
for (var node in nodes) {
|
|
294
|
+
if (nodes.hasOwnProperty(node)) {
|
|
295
|
+
var child = nodes[node];
|
|
296
|
+
if (getLinesCount(child.textContent) > 0) {
|
|
297
|
+
if (child.childNodes.length > 0) {
|
|
298
|
+
duplicateMultilineNodes(child);
|
|
299
|
+
} else {
|
|
300
|
+
duplicateMultilineNode(child.parentNode);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Method for fix multi-line elements implementation in highlight.js
|
|
309
|
+
* @param {HTMLElement} element
|
|
310
|
+
*/
|
|
311
|
+
function duplicateMultilineNode (element) {
|
|
312
|
+
var className = element.className;
|
|
313
|
+
|
|
314
|
+
if ( ! /hljs-/.test(className)) return;
|
|
315
|
+
|
|
316
|
+
var lines = getLines(element.innerHTML);
|
|
317
|
+
|
|
318
|
+
for (var i = 0, result = ''; i < lines.length; i++) {
|
|
319
|
+
var lineText = lines[i].length > 0 ? lines[i] : ' ';
|
|
320
|
+
result += format('<span class="{0}">{1}</span>\n', [ className, lineText ]);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
element.innerHTML = result.trim();
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function getLines (text) {
|
|
327
|
+
if (text.length === 0) return [];
|
|
328
|
+
return text.split(BREAK_LINE_REGEXP);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
function getLinesCount (text) {
|
|
332
|
+
return (text.trim().match(BREAK_LINE_REGEXP) || []).length;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
///
|
|
336
|
+
/// HELPERS
|
|
337
|
+
///
|
|
338
|
+
|
|
339
|
+
function async (func) {
|
|
340
|
+
w.setTimeout(func, 0);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* {@link https://wcoder.github.io/notes/string-format-for-string-formating-in-javascript}
|
|
345
|
+
* @param {string} format
|
|
346
|
+
* @param {array} args
|
|
347
|
+
*/
|
|
348
|
+
function format (format, args) {
|
|
349
|
+
return format.replace(/\{(\d+)\}/g, function(m, n){
|
|
350
|
+
return args[n] !== undefined ? args[n] : m;
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* @param {HTMLElement} element Code block.
|
|
356
|
+
* @param {String} attrName Attribute name.
|
|
357
|
+
* @returns {String} Attribute value or empty.
|
|
358
|
+
*/
|
|
359
|
+
function getAttribute (element, attrName) {
|
|
360
|
+
return element.hasAttribute(attrName) ? element.getAttribute(attrName) : null;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* @param {String} str Source string.
|
|
365
|
+
* @param {Number} fallback Fallback value.
|
|
366
|
+
* @returns Parsed number or fallback value.
|
|
367
|
+
*/
|
|
368
|
+
function toNumber (str, fallback) {
|
|
369
|
+
if (!str) return fallback;
|
|
370
|
+
var number = Number(str);
|
|
371
|
+
return isFinite(number) ? number : fallback;
|
|
372
|
+
}
|
|
190
373
|
});
|
|
@@ -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
|
+
}
|