marked 0.5.1 → 0.6.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/LICENSE.md +43 -0
- package/README.md +4 -3
- package/bin/marked +17 -1
- package/lib/marked.js +184 -99
- package/man/marked.1 +30 -7
- package/man/marked.1.txt +38 -35
- package/marked.min.js +1 -1
- package/package.json +19 -13
- package/.editorconfig +0 -16
- package/.eslintignore +0 -1
- package/.eslintrc.json +0 -28
- package/.travis.yml +0 -47
- package/Makefile +0 -15
- package/bower.json +0 -23
- package/component.json +0 -10
- package/index.js +0 -1
- package/jasmine.json +0 -11
package/LICENSE.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# License information
|
|
2
|
+
|
|
3
|
+
## Contribution License Agreement
|
|
4
|
+
|
|
5
|
+
If you contribute code to this project, you are implicitly allowing your code
|
|
6
|
+
to be distributed under the MIT license. You are also implicitly verifying that
|
|
7
|
+
all code is your original work. `</legalese>`
|
|
8
|
+
|
|
9
|
+
## Marked
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/)
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in
|
|
21
|
+
all copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
29
|
+
THE SOFTWARE.
|
|
30
|
+
|
|
31
|
+
## Markdown
|
|
32
|
+
|
|
33
|
+
Copyright © 2004, John Gruber
|
|
34
|
+
http://daringfireball.net/
|
|
35
|
+
All rights reserved.
|
|
36
|
+
|
|
37
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
38
|
+
|
|
39
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
40
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
41
|
+
* Neither the name “Markdown” nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
42
|
+
|
|
43
|
+
This software is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
|
package/README.md
CHANGED
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
[](https://cdn.jsdelivr.net/npm/marked/marked.min.js)
|
|
9
9
|
[](https://packagephobia.now.sh/result?p=marked)
|
|
10
10
|
[](https://www.npmjs.com/package/marked)
|
|
11
|
-
[](https://david-dm.org/markedjs/marked)
|
|
12
|
-
[](https://david-dm.org/markedjs/marked?type=dev)
|
|
11
|
+
[](https://david-dm.org/markedjs/marked)
|
|
12
|
+
[](https://david-dm.org/markedjs/marked?type=dev)
|
|
13
13
|
[](https://travis-ci.org/markedjs/marked)
|
|
14
|
+
[](https://snyk.io/test/npm/marked)
|
|
14
15
|
|
|
15
16
|
- ⚡ built for speed
|
|
16
17
|
- ⬇️ low-level compiler for parsing markdown without caching or blocking for long periods of time
|
|
@@ -34,7 +35,7 @@ Also read about:
|
|
|
34
35
|
|
|
35
36
|
**CLI:** `npm install -g marked`
|
|
36
37
|
|
|
37
|
-
**In-browser:** `npm install marked
|
|
38
|
+
**In-browser:** `npm install marked`
|
|
38
39
|
|
|
39
40
|
## Usage
|
|
40
41
|
|
package/bin/marked
CHANGED
|
@@ -32,6 +32,11 @@ function help() {
|
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
function version() {
|
|
36
|
+
var pkg = require('../package.json');
|
|
37
|
+
console.log(pkg.version);
|
|
38
|
+
}
|
|
39
|
+
|
|
35
40
|
/**
|
|
36
41
|
* Main
|
|
37
42
|
*/
|
|
@@ -98,6 +103,9 @@ function main(argv, callback) {
|
|
|
98
103
|
case '-h':
|
|
99
104
|
case '--help':
|
|
100
105
|
return help();
|
|
106
|
+
case '-v':
|
|
107
|
+
case '--version':
|
|
108
|
+
return version();
|
|
101
109
|
default:
|
|
102
110
|
if (arg.indexOf('--') === 0) {
|
|
103
111
|
opt = camelize(arg.replace(/^--(no-)?/, ''));
|
|
@@ -184,6 +192,14 @@ function camelize(text) {
|
|
|
184
192
|
});
|
|
185
193
|
}
|
|
186
194
|
|
|
195
|
+
function handleError(err) {
|
|
196
|
+
if (err.code === 'ENOENT') {
|
|
197
|
+
console.error(`marked: output to ${err.path}: No such directory`);
|
|
198
|
+
return process.exit(1);
|
|
199
|
+
}
|
|
200
|
+
throw err;
|
|
201
|
+
}
|
|
202
|
+
|
|
187
203
|
/**
|
|
188
204
|
* Expose / Entry Point
|
|
189
205
|
*/
|
|
@@ -191,7 +207,7 @@ function camelize(text) {
|
|
|
191
207
|
if (!module.parent) {
|
|
192
208
|
process.title = 'marked';
|
|
193
209
|
main(process.argv.slice(), function(err, code) {
|
|
194
|
-
if (err)
|
|
210
|
+
if (err) return handleError(err);
|
|
195
211
|
return process.exit(code || 0);
|
|
196
212
|
});
|
|
197
213
|
} else {
|
package/lib/marked.js
CHANGED
|
@@ -19,7 +19,7 @@ var block = {
|
|
|
19
19
|
heading: /^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,
|
|
20
20
|
nptable: noop,
|
|
21
21
|
blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
|
|
22
|
-
list: /^(
|
|
22
|
+
list: /^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
|
|
23
23
|
html: '^ {0,3}(?:' // optional indentation
|
|
24
24
|
+ '<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
|
|
25
25
|
+ '|comment[^\\n]*(\\n+|$)' // (2)
|
|
@@ -27,8 +27,8 @@ var block = {
|
|
|
27
27
|
+ '|<![A-Z][\\s\\S]*?>\\n*' // (4)
|
|
28
28
|
+ '|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*' // (5)
|
|
29
29
|
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
|
|
30
|
-
+ '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(
|
|
31
|
-
+ '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(
|
|
30
|
+
+ '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
|
|
31
|
+
+ '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag
|
|
32
32
|
+ ')',
|
|
33
33
|
def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
|
|
34
34
|
table: noop,
|
|
@@ -44,8 +44,8 @@ block.def = edit(block.def)
|
|
|
44
44
|
.replace('title', block._title)
|
|
45
45
|
.getRegex();
|
|
46
46
|
|
|
47
|
-
block.bullet = /(?:[*+-]|\d
|
|
48
|
-
block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;
|
|
47
|
+
block.bullet = /(?:[*+-]|\d{1,9}\.)/;
|
|
48
|
+
block.item = /^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/;
|
|
49
49
|
block.item = edit(block.item, 'gm')
|
|
50
50
|
.replace(/bull/g, block.bullet)
|
|
51
51
|
.getRegex();
|
|
@@ -91,7 +91,7 @@ block.normal = merge({}, block);
|
|
|
91
91
|
*/
|
|
92
92
|
|
|
93
93
|
block.gfm = merge({}, block.normal, {
|
|
94
|
-
fences: /^
|
|
94
|
+
fences: /^ {0,3}(`{3,}|~{3,})([^`\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
|
|
95
95
|
paragraph: /^/,
|
|
96
96
|
heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/
|
|
97
97
|
});
|
|
@@ -231,7 +231,7 @@ Lexer.prototype.token = function(src, top) {
|
|
|
231
231
|
src = src.substring(cap[0].length);
|
|
232
232
|
this.tokens.push({
|
|
233
233
|
type: 'code',
|
|
234
|
-
lang: cap[2],
|
|
234
|
+
lang: cap[2] ? cap[2].trim() : cap[2],
|
|
235
235
|
text: cap[3] || ''
|
|
236
236
|
});
|
|
237
237
|
continue;
|
|
@@ -249,7 +249,7 @@ Lexer.prototype.token = function(src, top) {
|
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
// table no leading pipe (gfm)
|
|
252
|
-
if (
|
|
252
|
+
if (cap = this.rules.nptable.exec(src)) {
|
|
253
253
|
item = {
|
|
254
254
|
type: 'table',
|
|
255
255
|
header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
|
|
@@ -342,7 +342,7 @@ Lexer.prototype.token = function(src, top) {
|
|
|
342
342
|
// Remove the list item's bullet
|
|
343
343
|
// so it is seen as the next token.
|
|
344
344
|
space = item.length;
|
|
345
|
-
item = item.replace(/^ *([*+-]|\d+\.)
|
|
345
|
+
item = item.replace(/^ *([*+-]|\d+\.) */, '');
|
|
346
346
|
|
|
347
347
|
// Outdent whatever the
|
|
348
348
|
// list item contains. Hacky.
|
|
@@ -355,9 +355,10 @@ Lexer.prototype.token = function(src, top) {
|
|
|
355
355
|
|
|
356
356
|
// Determine whether the next list item belongs here.
|
|
357
357
|
// Backpedal if it does not belong in this list.
|
|
358
|
-
if (
|
|
358
|
+
if (i !== l - 1) {
|
|
359
359
|
b = block.bullet.exec(cap[i + 1])[0];
|
|
360
|
-
if (bull
|
|
360
|
+
if (bull.length > 1 ? b.length === 1
|
|
361
|
+
: (b.length > 1 || (this.options.smartLists && b !== bull))) {
|
|
361
362
|
src = cap.slice(i + 1).join('\n') + src;
|
|
362
363
|
i = l - 1;
|
|
363
364
|
}
|
|
@@ -446,12 +447,12 @@ Lexer.prototype.token = function(src, top) {
|
|
|
446
447
|
}
|
|
447
448
|
|
|
448
449
|
// table (gfm)
|
|
449
|
-
if (
|
|
450
|
+
if (cap = this.rules.table.exec(src)) {
|
|
450
451
|
item = {
|
|
451
452
|
type: 'table',
|
|
452
453
|
header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
|
|
453
454
|
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
|
|
454
|
-
cells: cap[3] ? cap[3].replace(
|
|
455
|
+
cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
|
|
455
456
|
};
|
|
456
457
|
|
|
457
458
|
if (item.header.length === item.align.length) {
|
|
@@ -540,14 +541,19 @@ var inline = {
|
|
|
540
541
|
link: /^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,
|
|
541
542
|
reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,
|
|
542
543
|
nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,
|
|
543
|
-
strong: /^__([^\
|
|
544
|
-
em: /^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_)|^_([^\s_][\s\S]*?[^\s])_(?!_)|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,
|
|
544
|
+
strong: /^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,
|
|
545
|
+
em: /^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,
|
|
545
546
|
code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
|
|
546
547
|
br: /^( {2,}|\\)\n(?!\s*$)/,
|
|
547
548
|
del: noop,
|
|
548
|
-
text: /^(`+|[^`])[\s\S]*?(?=[\\<!\[`*]|\b_| {2,}\n
|
|
549
|
+
text: /^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/
|
|
549
550
|
};
|
|
550
551
|
|
|
552
|
+
// list of punctuation marks from common mark spec
|
|
553
|
+
// without ` and ] to workaround Rule 17 (inline code blocks/links)
|
|
554
|
+
inline._punctuation = '!"#$%&\'()*+,\\-./:;<=>?@\\[^_{|}~';
|
|
555
|
+
inline.em = edit(inline.em).replace(/punctuation/g, inline._punctuation).getRegex();
|
|
556
|
+
|
|
551
557
|
inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
|
|
552
558
|
|
|
553
559
|
inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
|
|
@@ -564,8 +570,8 @@ inline.tag = edit(inline.tag)
|
|
|
564
570
|
.replace('attribute', inline._attribute)
|
|
565
571
|
.getRegex();
|
|
566
572
|
|
|
567
|
-
inline._label = /(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]
|
|
568
|
-
inline._href = /\s*(<(?:\\[<>]?|[^\s<>\\])*>|
|
|
573
|
+
inline._label = /(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|`(?!`)|[^\[\]\\`])*?/;
|
|
574
|
+
inline._href = /\s*(<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*)/;
|
|
569
575
|
inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
|
|
570
576
|
|
|
571
577
|
inline.link = edit(inline.link)
|
|
@@ -609,13 +615,10 @@ inline.gfm = merge({}, inline.normal, {
|
|
|
609
615
|
url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
|
|
610
616
|
_backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
|
|
611
617
|
del: /^~+(?=\S)([\s\S]*?\S)~+/,
|
|
612
|
-
text:
|
|
613
|
-
.replace(']|', '~]|')
|
|
614
|
-
.replace('|$', '|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&\'*+/=?^_`{\\|}~-]+@|$')
|
|
615
|
-
.getRegex()
|
|
618
|
+
text: /^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/
|
|
616
619
|
});
|
|
617
620
|
|
|
618
|
-
inline.gfm.url = edit(inline.gfm.url)
|
|
621
|
+
inline.gfm.url = edit(inline.gfm.url, 'i')
|
|
619
622
|
.replace('email', inline.gfm._extended_email)
|
|
620
623
|
.getRegex();
|
|
621
624
|
/**
|
|
@@ -624,7 +627,7 @@ inline.gfm.url = edit(inline.gfm.url)
|
|
|
624
627
|
|
|
625
628
|
inline.breaks = merge({}, inline.gfm, {
|
|
626
629
|
br: edit(inline.br).replace('{2,}', '*').getRegex(),
|
|
627
|
-
text: edit(inline.gfm.text).replace(
|
|
630
|
+
text: edit(inline.gfm.text).replace(/\{2,\}/g, '*').getRegex()
|
|
628
631
|
});
|
|
629
632
|
|
|
630
633
|
/**
|
|
@@ -685,44 +688,7 @@ InlineLexer.prototype.output = function(src) {
|
|
|
685
688
|
// escape
|
|
686
689
|
if (cap = this.rules.escape.exec(src)) {
|
|
687
690
|
src = src.substring(cap[0].length);
|
|
688
|
-
out += cap[1];
|
|
689
|
-
continue;
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
// autolink
|
|
693
|
-
if (cap = this.rules.autolink.exec(src)) {
|
|
694
|
-
src = src.substring(cap[0].length);
|
|
695
|
-
if (cap[2] === '@') {
|
|
696
|
-
text = escape(this.mangle(cap[1]));
|
|
697
|
-
href = 'mailto:' + text;
|
|
698
|
-
} else {
|
|
699
|
-
text = escape(cap[1]);
|
|
700
|
-
href = text;
|
|
701
|
-
}
|
|
702
|
-
out += this.renderer.link(href, null, text);
|
|
703
|
-
continue;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
// url (gfm)
|
|
707
|
-
if (!this.inLink && (cap = this.rules.url.exec(src))) {
|
|
708
|
-
if (cap[2] === '@') {
|
|
709
|
-
text = escape(cap[0]);
|
|
710
|
-
href = 'mailto:' + text;
|
|
711
|
-
} else {
|
|
712
|
-
// do extended autolink path validation
|
|
713
|
-
do {
|
|
714
|
-
prevCapZero = cap[0];
|
|
715
|
-
cap[0] = this.rules._backpedal.exec(cap[0])[0];
|
|
716
|
-
} while (prevCapZero !== cap[0]);
|
|
717
|
-
text = escape(cap[0]);
|
|
718
|
-
if (cap[1] === 'www.') {
|
|
719
|
-
href = 'http://' + text;
|
|
720
|
-
} else {
|
|
721
|
-
href = text;
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
src = src.substring(cap[0].length);
|
|
725
|
-
out += this.renderer.link(href, null, text);
|
|
691
|
+
out += escape(cap[1]);
|
|
726
692
|
continue;
|
|
727
693
|
}
|
|
728
694
|
|
|
@@ -744,12 +710,19 @@ InlineLexer.prototype.output = function(src) {
|
|
|
744
710
|
? this.options.sanitizer
|
|
745
711
|
? this.options.sanitizer(cap[0])
|
|
746
712
|
: escape(cap[0])
|
|
747
|
-
: cap[0]
|
|
713
|
+
: cap[0];
|
|
748
714
|
continue;
|
|
749
715
|
}
|
|
750
716
|
|
|
751
717
|
// link
|
|
752
718
|
if (cap = this.rules.link.exec(src)) {
|
|
719
|
+
var lastParenIndex = findClosingBracket(cap[2], '()');
|
|
720
|
+
if (lastParenIndex > -1) {
|
|
721
|
+
var linkLen = cap[0].length - (cap[2].length - lastParenIndex) - (cap[3] || '').length;
|
|
722
|
+
cap[2] = cap[2].substring(0, lastParenIndex);
|
|
723
|
+
cap[0] = cap[0].substring(0, linkLen).trim();
|
|
724
|
+
cap[3] = '';
|
|
725
|
+
}
|
|
753
726
|
src = src.substring(cap[0].length);
|
|
754
727
|
this.inLink = true;
|
|
755
728
|
href = cap[2];
|
|
@@ -826,6 +799,43 @@ InlineLexer.prototype.output = function(src) {
|
|
|
826
799
|
continue;
|
|
827
800
|
}
|
|
828
801
|
|
|
802
|
+
// autolink
|
|
803
|
+
if (cap = this.rules.autolink.exec(src)) {
|
|
804
|
+
src = src.substring(cap[0].length);
|
|
805
|
+
if (cap[2] === '@') {
|
|
806
|
+
text = escape(this.mangle(cap[1]));
|
|
807
|
+
href = 'mailto:' + text;
|
|
808
|
+
} else {
|
|
809
|
+
text = escape(cap[1]);
|
|
810
|
+
href = text;
|
|
811
|
+
}
|
|
812
|
+
out += this.renderer.link(href, null, text);
|
|
813
|
+
continue;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
// url (gfm)
|
|
817
|
+
if (!this.inLink && (cap = this.rules.url.exec(src))) {
|
|
818
|
+
if (cap[2] === '@') {
|
|
819
|
+
text = escape(cap[0]);
|
|
820
|
+
href = 'mailto:' + text;
|
|
821
|
+
} else {
|
|
822
|
+
// do extended autolink path validation
|
|
823
|
+
do {
|
|
824
|
+
prevCapZero = cap[0];
|
|
825
|
+
cap[0] = this.rules._backpedal.exec(cap[0])[0];
|
|
826
|
+
} while (prevCapZero !== cap[0]);
|
|
827
|
+
text = escape(cap[0]);
|
|
828
|
+
if (cap[1] === 'www.') {
|
|
829
|
+
href = 'http://' + text;
|
|
830
|
+
} else {
|
|
831
|
+
href = text;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
src = src.substring(cap[0].length);
|
|
835
|
+
out += this.renderer.link(href, null, text);
|
|
836
|
+
continue;
|
|
837
|
+
}
|
|
838
|
+
|
|
829
839
|
// text
|
|
830
840
|
if (cap = this.rules.text.exec(src)) {
|
|
831
841
|
src = src.substring(cap[0].length);
|
|
@@ -847,7 +857,7 @@ InlineLexer.prototype.output = function(src) {
|
|
|
847
857
|
|
|
848
858
|
InlineLexer.escapes = function(text) {
|
|
849
859
|
return text ? text.replace(InlineLexer.rules._escapes, '$1') : text;
|
|
850
|
-
}
|
|
860
|
+
};
|
|
851
861
|
|
|
852
862
|
/**
|
|
853
863
|
* Compile Link
|
|
@@ -915,7 +925,8 @@ function Renderer(options) {
|
|
|
915
925
|
this.options = options || marked.defaults;
|
|
916
926
|
}
|
|
917
927
|
|
|
918
|
-
Renderer.prototype.code = function(code,
|
|
928
|
+
Renderer.prototype.code = function(code, infostring, escaped) {
|
|
929
|
+
var lang = (infostring || '').match(/\S*/)[0];
|
|
919
930
|
if (this.options.highlight) {
|
|
920
931
|
var out = this.options.highlight(code, lang);
|
|
921
932
|
if (out != null && out !== code) {
|
|
@@ -946,13 +957,13 @@ Renderer.prototype.html = function(html) {
|
|
|
946
957
|
return html;
|
|
947
958
|
};
|
|
948
959
|
|
|
949
|
-
Renderer.prototype.heading = function(text, level, raw) {
|
|
960
|
+
Renderer.prototype.heading = function(text, level, raw, slugger) {
|
|
950
961
|
if (this.options.headerIds) {
|
|
951
962
|
return '<h'
|
|
952
963
|
+ level
|
|
953
964
|
+ ' id="'
|
|
954
965
|
+ this.options.headerPrefix
|
|
955
|
-
+
|
|
966
|
+
+ slugger.slug(raw)
|
|
956
967
|
+ '">'
|
|
957
968
|
+ text
|
|
958
969
|
+ '</h'
|
|
@@ -983,7 +994,7 @@ Renderer.prototype.checkbox = function(checked) {
|
|
|
983
994
|
+ 'disabled="" type="checkbox"'
|
|
984
995
|
+ (this.options.xhtml ? ' /' : '')
|
|
985
996
|
+ '> ';
|
|
986
|
-
}
|
|
997
|
+
};
|
|
987
998
|
|
|
988
999
|
Renderer.prototype.paragraph = function(text) {
|
|
989
1000
|
return '<p>' + text + '</p>\n';
|
|
@@ -1034,24 +1045,8 @@ Renderer.prototype.del = function(text) {
|
|
|
1034
1045
|
};
|
|
1035
1046
|
|
|
1036
1047
|
Renderer.prototype.link = function(href, title, text) {
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
var prot = decodeURIComponent(unescape(href))
|
|
1040
|
-
.replace(/[^\w:]/g, '')
|
|
1041
|
-
.toLowerCase();
|
|
1042
|
-
} catch (e) {
|
|
1043
|
-
return text;
|
|
1044
|
-
}
|
|
1045
|
-
if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
|
|
1046
|
-
return text;
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
if (this.options.baseUrl && !originIndependentUrl.test(href)) {
|
|
1050
|
-
href = resolveUrl(this.options.baseUrl, href);
|
|
1051
|
-
}
|
|
1052
|
-
try {
|
|
1053
|
-
href = encodeURI(href).replace(/%25/g, '%');
|
|
1054
|
-
} catch (e) {
|
|
1048
|
+
href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
|
|
1049
|
+
if (href === null) {
|
|
1055
1050
|
return text;
|
|
1056
1051
|
}
|
|
1057
1052
|
var out = '<a href="' + escape(href) + '"';
|
|
@@ -1063,9 +1058,11 @@ Renderer.prototype.link = function(href, title, text) {
|
|
|
1063
1058
|
};
|
|
1064
1059
|
|
|
1065
1060
|
Renderer.prototype.image = function(href, title, text) {
|
|
1066
|
-
|
|
1067
|
-
|
|
1061
|
+
href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
|
|
1062
|
+
if (href === null) {
|
|
1063
|
+
return text;
|
|
1068
1064
|
}
|
|
1065
|
+
|
|
1069
1066
|
var out = '<img src="' + href + '" alt="' + text + '"';
|
|
1070
1067
|
if (title) {
|
|
1071
1068
|
out += ' title="' + title + '"';
|
|
@@ -1093,16 +1090,16 @@ TextRenderer.prototype.codespan =
|
|
|
1093
1090
|
TextRenderer.prototype.del =
|
|
1094
1091
|
TextRenderer.prototype.text = function (text) {
|
|
1095
1092
|
return text;
|
|
1096
|
-
}
|
|
1093
|
+
};
|
|
1097
1094
|
|
|
1098
1095
|
TextRenderer.prototype.link =
|
|
1099
1096
|
TextRenderer.prototype.image = function(href, title, text) {
|
|
1100
1097
|
return '' + text;
|
|
1101
|
-
}
|
|
1098
|
+
};
|
|
1102
1099
|
|
|
1103
1100
|
TextRenderer.prototype.br = function() {
|
|
1104
1101
|
return '';
|
|
1105
|
-
}
|
|
1102
|
+
};
|
|
1106
1103
|
|
|
1107
1104
|
/**
|
|
1108
1105
|
* Parsing & Compiling
|
|
@@ -1115,6 +1112,7 @@ function Parser(options) {
|
|
|
1115
1112
|
this.options.renderer = this.options.renderer || new Renderer();
|
|
1116
1113
|
this.renderer = this.options.renderer;
|
|
1117
1114
|
this.renderer.options = this.options;
|
|
1115
|
+
this.slugger = new Slugger();
|
|
1118
1116
|
}
|
|
1119
1117
|
|
|
1120
1118
|
/**
|
|
@@ -1193,7 +1191,8 @@ Parser.prototype.tok = function() {
|
|
|
1193
1191
|
return this.renderer.heading(
|
|
1194
1192
|
this.inline.output(this.token.text),
|
|
1195
1193
|
this.token.depth,
|
|
1196
|
-
unescape(this.inlineText.output(this.token.text))
|
|
1194
|
+
unescape(this.inlineText.output(this.token.text)),
|
|
1195
|
+
this.slugger);
|
|
1197
1196
|
}
|
|
1198
1197
|
case 'code': {
|
|
1199
1198
|
return this.renderer.code(this.token.text,
|
|
@@ -1256,9 +1255,11 @@ Parser.prototype.tok = function() {
|
|
|
1256
1255
|
case 'list_item_start': {
|
|
1257
1256
|
body = '';
|
|
1258
1257
|
var loose = this.token.loose;
|
|
1258
|
+
var checked = this.token.checked;
|
|
1259
|
+
var task = this.token.task;
|
|
1259
1260
|
|
|
1260
1261
|
if (this.token.task) {
|
|
1261
|
-
body += this.renderer.checkbox(
|
|
1262
|
+
body += this.renderer.checkbox(checked);
|
|
1262
1263
|
}
|
|
1263
1264
|
|
|
1264
1265
|
while (this.next().type !== 'list_item_end') {
|
|
@@ -1266,8 +1267,7 @@ Parser.prototype.tok = function() {
|
|
|
1266
1267
|
? this.parseText()
|
|
1267
1268
|
: this.tok();
|
|
1268
1269
|
}
|
|
1269
|
-
|
|
1270
|
-
return this.renderer.listitem(body);
|
|
1270
|
+
return this.renderer.listitem(body, task, checked);
|
|
1271
1271
|
}
|
|
1272
1272
|
case 'html': {
|
|
1273
1273
|
// TODO parse inline content if parameter markdown=1
|
|
@@ -1279,7 +1279,46 @@ Parser.prototype.tok = function() {
|
|
|
1279
1279
|
case 'text': {
|
|
1280
1280
|
return this.renderer.paragraph(this.parseText());
|
|
1281
1281
|
}
|
|
1282
|
+
default: {
|
|
1283
|
+
var errMsg = 'Token with "' + this.token.type + '" type was not found.';
|
|
1284
|
+
if (this.options.silent) {
|
|
1285
|
+
console.log(errMsg);
|
|
1286
|
+
} else {
|
|
1287
|
+
throw new Error(errMsg);
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
};
|
|
1292
|
+
|
|
1293
|
+
/**
|
|
1294
|
+
* Slugger generates header id
|
|
1295
|
+
*/
|
|
1296
|
+
|
|
1297
|
+
function Slugger () {
|
|
1298
|
+
this.seen = {};
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
/**
|
|
1302
|
+
* Convert string to unique id
|
|
1303
|
+
*/
|
|
1304
|
+
|
|
1305
|
+
Slugger.prototype.slug = function (value) {
|
|
1306
|
+
var slug = value
|
|
1307
|
+
.toLowerCase()
|
|
1308
|
+
.trim()
|
|
1309
|
+
.replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '')
|
|
1310
|
+
.replace(/\s/g, '-');
|
|
1311
|
+
|
|
1312
|
+
if (this.seen.hasOwnProperty(slug)) {
|
|
1313
|
+
var originalSlug = slug;
|
|
1314
|
+
do {
|
|
1315
|
+
this.seen[originalSlug]++;
|
|
1316
|
+
slug = originalSlug + '-' + this.seen[originalSlug];
|
|
1317
|
+
} while (this.seen.hasOwnProperty(slug));
|
|
1282
1318
|
}
|
|
1319
|
+
this.seen[slug] = 0;
|
|
1320
|
+
|
|
1321
|
+
return slug;
|
|
1283
1322
|
};
|
|
1284
1323
|
|
|
1285
1324
|
/**
|
|
@@ -1289,11 +1328,11 @@ Parser.prototype.tok = function() {
|
|
|
1289
1328
|
function escape(html, encode) {
|
|
1290
1329
|
if (encode) {
|
|
1291
1330
|
if (escape.escapeTest.test(html)) {
|
|
1292
|
-
return html.replace(escape.escapeReplace, function (ch) { return escape.replacements[ch] });
|
|
1331
|
+
return html.replace(escape.escapeReplace, function (ch) { return escape.replacements[ch]; });
|
|
1293
1332
|
}
|
|
1294
1333
|
} else {
|
|
1295
1334
|
if (escape.escapeTestNoEncode.test(html)) {
|
|
1296
|
-
return html.replace(escape.escapeReplaceNoEncode, function (ch) { return escape.replacements[ch] });
|
|
1335
|
+
return html.replace(escape.escapeReplaceNoEncode, function (ch) { return escape.replacements[ch]; });
|
|
1297
1336
|
}
|
|
1298
1337
|
}
|
|
1299
1338
|
|
|
@@ -1343,6 +1382,30 @@ function edit(regex, opt) {
|
|
|
1343
1382
|
};
|
|
1344
1383
|
}
|
|
1345
1384
|
|
|
1385
|
+
function cleanUrl(sanitize, base, href) {
|
|
1386
|
+
if (sanitize) {
|
|
1387
|
+
try {
|
|
1388
|
+
var prot = decodeURIComponent(unescape(href))
|
|
1389
|
+
.replace(/[^\w:]/g, '')
|
|
1390
|
+
.toLowerCase();
|
|
1391
|
+
} catch (e) {
|
|
1392
|
+
return null;
|
|
1393
|
+
}
|
|
1394
|
+
if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
|
|
1395
|
+
return null;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
if (base && !originIndependentUrl.test(href)) {
|
|
1399
|
+
href = resolveUrl(base, href);
|
|
1400
|
+
}
|
|
1401
|
+
try {
|
|
1402
|
+
href = encodeURI(href).replace(/%25/g, '%');
|
|
1403
|
+
} catch (e) {
|
|
1404
|
+
return null;
|
|
1405
|
+
}
|
|
1406
|
+
return href;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1346
1409
|
function resolveUrl(base, href) {
|
|
1347
1410
|
if (!baseUrls[' ' + base]) {
|
|
1348
1411
|
// we can ignore everything in base after the last slash of its path component,
|
|
@@ -1445,6 +1508,26 @@ function rtrim(str, c, invert) {
|
|
|
1445
1508
|
return str.substr(0, str.length - suffLen);
|
|
1446
1509
|
}
|
|
1447
1510
|
|
|
1511
|
+
function findClosingBracket(str, b) {
|
|
1512
|
+
if (str.indexOf(b[1]) === -1) {
|
|
1513
|
+
return -1;
|
|
1514
|
+
}
|
|
1515
|
+
var level = 0;
|
|
1516
|
+
for (var i = 0; i < str.length; i++) {
|
|
1517
|
+
if (str[i] === '\\') {
|
|
1518
|
+
i++;
|
|
1519
|
+
} else if (str[i] === b[0]) {
|
|
1520
|
+
level++;
|
|
1521
|
+
} else if (str[i] === b[1]) {
|
|
1522
|
+
level--;
|
|
1523
|
+
if (level < 0) {
|
|
1524
|
+
return i;
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
return -1;
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1448
1531
|
/**
|
|
1449
1532
|
* Marked
|
|
1450
1533
|
*/
|
|
@@ -1473,7 +1556,7 @@ function marked(src, opt, callback) {
|
|
|
1473
1556
|
i = 0;
|
|
1474
1557
|
|
|
1475
1558
|
try {
|
|
1476
|
-
tokens = Lexer.lex(src, opt)
|
|
1559
|
+
tokens = Lexer.lex(src, opt);
|
|
1477
1560
|
} catch (e) {
|
|
1478
1561
|
return callback(e);
|
|
1479
1562
|
}
|
|
@@ -1572,7 +1655,7 @@ marked.getDefaults = function () {
|
|
|
1572
1655
|
tables: true,
|
|
1573
1656
|
xhtml: false
|
|
1574
1657
|
};
|
|
1575
|
-
}
|
|
1658
|
+
};
|
|
1576
1659
|
|
|
1577
1660
|
marked.defaults = marked.getDefaults();
|
|
1578
1661
|
|
|
@@ -1592,6 +1675,8 @@ marked.lexer = Lexer.lex;
|
|
|
1592
1675
|
marked.InlineLexer = InlineLexer;
|
|
1593
1676
|
marked.inlineLexer = InlineLexer.output;
|
|
1594
1677
|
|
|
1678
|
+
marked.Slugger = Slugger;
|
|
1679
|
+
|
|
1595
1680
|
marked.parse = marked;
|
|
1596
1681
|
|
|
1597
1682
|
if (typeof module !== 'undefined' && typeof exports === 'object') {
|
package/man/marked.1
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.ds q \N'34'
|
|
2
|
-
.TH marked 1
|
|
2
|
+
.TH marked 1
|
|
3
3
|
|
|
4
4
|
.SH NAME
|
|
5
5
|
marked \- a javascript markdown parser
|
|
@@ -14,8 +14,8 @@ marked \- a javascript markdown parser
|
|
|
14
14
|
|
|
15
15
|
.SH DESCRIPTION
|
|
16
16
|
.B marked
|
|
17
|
-
is a full-featured javascript markdown parser, built for speed.
|
|
18
|
-
multiple GFM features.
|
|
17
|
+
is a full-featured javascript markdown parser, built for speed.
|
|
18
|
+
It also includes multiple GFM features.
|
|
19
19
|
|
|
20
20
|
.SH EXAMPLES
|
|
21
21
|
.TP
|
|
@@ -33,15 +33,38 @@ marked \-\-output="hello world.html" \-i in.md \-\-no-breaks
|
|
|
33
33
|
Specify file output. If none is specified, write to stdout.
|
|
34
34
|
.TP
|
|
35
35
|
.BI \-i,\ \-\-input\ [\fIinput\fP]
|
|
36
|
-
Specify file input, otherwise use last argument as input file.
|
|
37
|
-
is specified, read from stdin.
|
|
36
|
+
Specify file input, otherwise use last argument as input file.
|
|
37
|
+
If no input file is specified, read from stdin.
|
|
38
|
+
.TP
|
|
39
|
+
.BI \-\-test
|
|
40
|
+
Makes sure the test(s) pass.
|
|
41
|
+
.RS
|
|
42
|
+
.PP
|
|
43
|
+
.B \-\-glob [\fIfile\fP]
|
|
44
|
+
Specify which test to use.
|
|
45
|
+
.PP
|
|
46
|
+
.B \-\-fix
|
|
47
|
+
Fixes tests.
|
|
48
|
+
.PP
|
|
49
|
+
.B \-\-bench
|
|
50
|
+
Benchmarks the test(s).
|
|
51
|
+
.PP
|
|
52
|
+
.B \-\-time
|
|
53
|
+
Times The test(s).
|
|
54
|
+
.PP
|
|
55
|
+
.B \-\-minified
|
|
56
|
+
Runs test file(s) as minified.
|
|
57
|
+
.PP
|
|
58
|
+
.B \-\-stop
|
|
59
|
+
Stop process if a test fails.
|
|
60
|
+
.RE
|
|
38
61
|
.TP
|
|
39
62
|
.BI \-t,\ \-\-tokens
|
|
40
63
|
Output a token stream instead of html.
|
|
41
64
|
.TP
|
|
42
65
|
.BI \-\-pedantic
|
|
43
|
-
Conform to obscure parts of markdown.pl as much as possible.
|
|
44
|
-
markdown bugs.
|
|
66
|
+
Conform to obscure parts of markdown.pl as much as possible.
|
|
67
|
+
Don't fix original markdown bugs.
|
|
45
68
|
.TP
|
|
46
69
|
.BI \-\-gfm
|
|
47
70
|
Enable github flavored markdown.
|
package/man/marked.1.txt
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
marked(1)
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
marked(1) General Commands Manual marked(1)
|
|
4
2
|
|
|
5
3
|
NAME
|
|
6
4
|
marked - a javascript markdown parser
|
|
7
5
|
|
|
8
|
-
|
|
9
6
|
SYNOPSIS
|
|
10
|
-
marked [-o <output>] [-i <input>] [--help]
|
|
11
|
-
[--gfm]
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
marked [-o <output>] [-i <input>] [--help] [--tokens]
|
|
8
|
+
[--pedantic] [--gfm] [--breaks] [--tables] [--sanitize]
|
|
9
|
+
[--smart-lists] [--lang-prefix <prefix>] [--no-etc...] [--silent]
|
|
10
|
+
[filename]
|
|
14
11
|
|
|
15
12
|
DESCRIPTION
|
|
16
|
-
marked
|
|
13
|
+
marked is a full-featured javascript markdown parser, built for speed.
|
|
17
14
|
It also includes multiple GFM features.
|
|
18
15
|
|
|
19
|
-
|
|
20
16
|
EXAMPLES
|
|
21
17
|
cat in.md | marked > out.html
|
|
22
18
|
|
|
@@ -26,71 +22,78 @@ EXAMPLES
|
|
|
26
22
|
|
|
27
23
|
marked --output="hello world.html" -i in.md --no-breaks
|
|
28
24
|
|
|
29
|
-
|
|
30
25
|
OPTIONS
|
|
31
26
|
-o, --output [output]
|
|
32
|
-
|
|
27
|
+
Specify file output. If none is specified, write to stdout.
|
|
33
28
|
|
|
34
29
|
-i, --input [input]
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
Specify file input, otherwise use last argument as input file.
|
|
31
|
+
If no input file is specified, read from stdin.
|
|
32
|
+
|
|
33
|
+
--test Makes sure the test(s) pass.
|
|
34
|
+
|
|
35
|
+
--glob [file] Specify which test to use.
|
|
36
|
+
|
|
37
|
+
--fix Fixes tests.
|
|
38
|
+
|
|
39
|
+
--bench Benchmarks the test(s).
|
|
40
|
+
|
|
41
|
+
--time Times The test(s).
|
|
42
|
+
|
|
43
|
+
--minified Runs test file(s) as minified.
|
|
44
|
+
|
|
45
|
+
--stop Stop process if a test fails.
|
|
37
46
|
|
|
38
47
|
-t, --tokens
|
|
39
|
-
|
|
48
|
+
Output a token stream instead of html.
|
|
40
49
|
|
|
41
50
|
--pedantic
|
|
42
|
-
|
|
43
|
-
|
|
51
|
+
Conform to obscure parts of markdown.pl as much as possible.
|
|
52
|
+
Don't fix original markdown bugs.
|
|
44
53
|
|
|
45
54
|
--gfm Enable github flavored markdown.
|
|
46
55
|
|
|
47
56
|
--breaks
|
|
48
|
-
|
|
57
|
+
Enable GFM line breaks. Only works with the gfm option.
|
|
49
58
|
|
|
50
59
|
--tables
|
|
51
|
-
|
|
60
|
+
Enable GFM tables. Only works with the gfm option.
|
|
52
61
|
|
|
53
62
|
--sanitize
|
|
54
|
-
|
|
63
|
+
Sanitize output. Ignore any HTML input.
|
|
55
64
|
|
|
56
65
|
--smart-lists
|
|
57
|
-
|
|
66
|
+
Use smarter list behavior than the original markdown.
|
|
58
67
|
|
|
59
68
|
--lang-prefix [prefix]
|
|
60
|
-
|
|
69
|
+
Set the prefix for code block classes.
|
|
61
70
|
|
|
62
71
|
--mangle
|
|
63
|
-
|
|
72
|
+
Mangle email addresses.
|
|
64
73
|
|
|
65
74
|
--no-sanitize, -no-etc...
|
|
66
|
-
|
|
75
|
+
The inverse of any of the marked options above.
|
|
67
76
|
|
|
68
77
|
--silent
|
|
69
|
-
|
|
78
|
+
Silence error output.
|
|
70
79
|
|
|
71
80
|
-h, --help
|
|
72
|
-
|
|
73
|
-
|
|
81
|
+
Display help information.
|
|
74
82
|
|
|
75
83
|
CONFIGURATION
|
|
76
84
|
For configuring and running programmatically.
|
|
77
85
|
|
|
78
86
|
Example
|
|
79
87
|
|
|
80
|
-
|
|
81
|
-
|
|
88
|
+
require('marked')('*foo*', { gfm: true });
|
|
82
89
|
|
|
83
90
|
BUGS
|
|
84
|
-
Please report any bugs to https://github.com/
|
|
85
|
-
|
|
91
|
+
Please report any bugs to https://github.com/markedjs/marked.
|
|
86
92
|
|
|
87
93
|
LICENSE
|
|
88
94
|
Copyright (c) 2011-2014, Christopher Jeffrey (MIT License).
|
|
89
95
|
|
|
90
|
-
|
|
91
96
|
SEE ALSO
|
|
92
97
|
markdown(1), node.js(1)
|
|
93
98
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
v0.3.1 2014-01-31 marked(1)
|
|
99
|
+
marked(1)
|
package/marked.min.js
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT Licensed)
|
|
4
4
|
* https://github.com/markedjs/marked
|
|
5
5
|
*/
|
|
6
|
-
!function(e){"use strict";var k={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:g,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,nptable:g,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:g,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,text:/^[^\n]+/};function a(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||d.defaults,this.rules=k.normal,this.options.pedantic?this.rules=k.pedantic:this.options.gfm&&(this.options.tables?this.rules=k.tables:this.rules=k.gfm)}k._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,k._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,k.def=t(k.def).replace("label",k._label).replace("title",k._title).getRegex(),k.bullet=/(?:[*+-]|\d+\.)/,k.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,k.item=t(k.item,"gm").replace(/bull/g,k.bullet).getRegex(),k.list=t(k.list).replace(/bull/g,k.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+k.def.source+")").getRegex(),k._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",k._comment=/<!--(?!-?>)[\s\S]*?-->/,k.html=t(k.html,"i").replace("comment",k._comment).replace("tag",k._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),k.paragraph=t(k.paragraph).replace("hr",k.hr).replace("heading",k.heading).replace("lheading",k.lheading).replace("tag",k._tag).getRegex(),k.blockquote=t(k.blockquote).replace("paragraph",k.paragraph).getRegex(),k.normal=f({},k),k.gfm=f({},k.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),k.gfm.paragraph=t(k.paragraph).replace("(?!","(?!"+k.gfm.fences.source.replace("\\1","\\2")+"|"+k.list.source.replace("\\1","\\3")+"|").getRegex(),k.tables=f({},k.gfm,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/}),k.pedantic=f({},k.normal,{html:t("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",k._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/}),a.rules=k,a.lex=function(e,t){return new a(t).lex(e)},a.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},a.prototype.token=function(e,t){var n,r,s,i,l,o,a,h,p,c,u,g,f,d,b,m;for(e=e.replace(/^ +$/gm,"");e;)if((s=this.rules.newline.exec(e))&&(e=e.substring(s[0].length),1<s[0].length&&this.tokens.push({type:"space"})),s=this.rules.code.exec(e))e=e.substring(s[0].length),s=s[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?s:y(s,"\n")});else if(s=this.rules.fences.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"code",lang:s[2],text:s[3]||""});else if(s=this.rules.heading.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"heading",depth:s[1].length,text:s[2]});else if(t&&(s=this.rules.nptable.exec(e))&&(o={type:"table",header:x(s[1].replace(/^ *| *\| *$/g,"")),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3]?s[3].replace(/\n$/,"").split("\n"):[]}).header.length===o.align.length){for(e=e.substring(s[0].length),u=0;u<o.align.length;u++)/^ *-+: *$/.test(o.align[u])?o.align[u]="right":/^ *:-+: *$/.test(o.align[u])?o.align[u]="center":/^ *:-+ *$/.test(o.align[u])?o.align[u]="left":o.align[u]=null;for(u=0;u<o.cells.length;u++)o.cells[u]=x(o.cells[u],o.header.length);this.tokens.push(o)}else if(s=this.rules.hr.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"hr"});else if(s=this.rules.blockquote.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"blockquote_start"}),s=s[0].replace(/^ *> ?/gm,""),this.token(s,t),this.tokens.push({type:"blockquote_end"});else if(s=this.rules.list.exec(e)){for(e=e.substring(s[0].length),a={type:"list_start",ordered:d=1<(i=s[2]).length,start:d?+i:"",loose:!1},this.tokens.push(a),n=!(h=[]),f=(s=s[0].match(this.rules.item)).length,u=0;u<f;u++)c=(o=s[u]).length,~(o=o.replace(/^ *([*+-]|\d+\.) +/,"")).indexOf("\n ")&&(c-=o.length,o=this.options.pedantic?o.replace(/^ {1,4}/gm,""):o.replace(new RegExp("^ {1,"+c+"}","gm"),"")),this.options.smartLists&&u!==f-1&&(i===(l=k.bullet.exec(s[u+1])[0])||1<i.length&&1<l.length||(e=s.slice(u+1).join("\n")+e,u=f-1)),r=n||/\n\n(?!\s*$)/.test(o),u!==f-1&&(n="\n"===o.charAt(o.length-1),r||(r=n)),r&&(a.loose=!0),m=void 0,(b=/^\[[ xX]\] /.test(o))&&(m=" "!==o[1],o=o.replace(/^\[[ xX]\] +/,"")),p={type:"list_item_start",task:b,checked:m,loose:r},h.push(p),this.tokens.push(p),this.token(o,!1),this.tokens.push({type:"list_item_end"});if(a.loose)for(f=h.length,u=0;u<f;u++)h[u].loose=!0;this.tokens.push({type:"list_end"})}else if(s=this.rules.html.exec(e))e=e.substring(s[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===s[1]||"script"===s[1]||"style"===s[1]),text:s[0]});else if(t&&(s=this.rules.def.exec(e)))e=e.substring(s[0].length),s[3]&&(s[3]=s[3].substring(1,s[3].length-1)),g=s[1].toLowerCase().replace(/\s+/g," "),this.tokens.links[g]||(this.tokens.links[g]={href:s[2],title:s[3]});else if(t&&(s=this.rules.table.exec(e))&&(o={type:"table",header:x(s[1].replace(/^ *| *\| *$/g,"")),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3]?s[3].replace(/(?: *\| *)?\n$/,"").split("\n"):[]}).header.length===o.align.length){for(e=e.substring(s[0].length),u=0;u<o.align.length;u++)/^ *-+: *$/.test(o.align[u])?o.align[u]="right":/^ *:-+: *$/.test(o.align[u])?o.align[u]="center":/^ *:-+ *$/.test(o.align[u])?o.align[u]="left":o.align[u]=null;for(u=0;u<o.cells.length;u++)o.cells[u]=x(o.cells[u].replace(/^ *\| *| *\| *$/g,""),o.header.length);this.tokens.push(o)}else if(s=this.rules.lheading.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"heading",depth:"="===s[2]?1:2,text:s[1]});else if(t&&(s=this.rules.paragraph.exec(e)))e=e.substring(s[0].length),this.tokens.push({type:"paragraph",text:"\n"===s[1].charAt(s[1].length-1)?s[1].slice(0,-1):s[1]});else if(s=this.rules.text.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"text",text:s[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens};var n={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:g,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s])__(?!_)|^\*\*([^\s])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,em:/^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_)|^_([^\s_][\s\S]*?[^\s])_(?!_)|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:g,text:/^(`+|[^`])[\s\S]*?(?=[\\<!\[`*]|\b_| {2,}\n|$)/};function h(e,t){if(this.options=t||d.defaults,this.links=e,this.rules=n.normal,this.renderer=this.options.renderer||new r,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.pedantic?this.rules=n.pedantic:this.options.gfm&&(this.options.breaks?this.rules=n.breaks:this.rules=n.gfm)}function r(e){this.options=e||d.defaults}function s(){}function p(e){this.tokens=[],this.token=null,this.options=e||d.defaults,this.options.renderer=this.options.renderer||new r,this.renderer=this.options.renderer,this.renderer.options=this.options}function c(e,t){if(t){if(c.escapeTest.test(e))return e.replace(c.escapeReplace,function(e){return c.replacements[e]})}else if(c.escapeTestNoEncode.test(e))return e.replace(c.escapeReplaceNoEncode,function(e){return c.replacements[e]});return e}function u(e){return e.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function t(n,e){return n=n.source||n,e=e||"",{replace:function(e,t){return t=(t=t.source||t).replace(/(^|[^\[])\^/g,"$1"),n=n.replace(e,t),this},getRegex:function(){return new RegExp(n,e)}}}function i(e,t){return l[" "+e]||(/^[^:]+:\/*[^/]*$/.test(e)?l[" "+e]=e+"/":l[" "+e]=y(e,"/",!0)),e=l[" "+e],"//"===t.slice(0,2)?e.replace(/:[\s\S]*/,":")+t:"/"===t.charAt(0)?e.replace(/(:\/*[^/]*)[\s\S]*/,"$1")+t:e+t}n._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,n._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,n._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,n.autolink=t(n.autolink).replace("scheme",n._scheme).replace("email",n._email).getRegex(),n._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,n.tag=t(n.tag).replace("comment",k._comment).replace("attribute",n._attribute).getRegex(),n._label=/(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/,n._href=/\s*(<(?:\\[<>]?|[^\s<>\\])*>|(?:\\[()]?|\([^\s\x00-\x1f\\]*\)|[^\s\x00-\x1f()\\])*?)/,n._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,n.link=t(n.link).replace("label",n._label).replace("href",n._href).replace("title",n._title).getRegex(),n.reflink=t(n.reflink).replace("label",n._label).getRegex(),n.normal=f({},n),n.pedantic=f({},n.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:t(/^!?\[(label)\]\((.*?)\)/).replace("label",n._label).getRegex(),reflink:t(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",n._label).getRegex()}),n.gfm=f({},n.normal,{escape:t(n.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:t(n.text).replace("]|","~]|").replace("|$","|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&'*+/=?^_`{\\|}~-]+@|$").getRegex()}),n.gfm.url=t(n.gfm.url).replace("email",n.gfm._extended_email).getRegex(),n.breaks=f({},n.gfm,{br:t(n.br).replace("{2,}","*").getRegex(),text:t(n.gfm.text).replace("{2,}","*").getRegex()}),h.rules=n,h.output=function(e,t,n){return new h(t,n).output(e)},h.prototype.output=function(e){for(var t,n,r,s,i,l,o="";e;)if(i=this.rules.escape.exec(e))e=e.substring(i[0].length),o+=i[1];else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),r="@"===i[2]?"mailto:"+(n=c(this.mangle(i[1]))):n=c(i[1]),o+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.tag.exec(e))!this.inLink&&/^<a /i.test(i[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(i[0])&&(this.inLink=!1),!this.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(i[0])?this.inRawBlock=!0:this.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(i[0])&&(this.inRawBlock=!1),e=e.substring(i[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):c(i[0]):i[0];else if(i=this.rules.link.exec(e))e=e.substring(i[0].length),this.inLink=!0,r=i[2],this.options.pedantic?(t=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r))?(r=t[1],s=t[3]):s="":s=i[3]?i[3].slice(1,-1):"",r=r.trim().replace(/^<([\s\S]*)>$/,"$1"),o+=this.outputLink(i,{href:h.escapes(r),title:h.escapes(s)}),this.inLink=!1;else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){o+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),o+=this.renderer.strong(this.output(i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),o+=this.renderer.em(this.output(i[6]||i[5]||i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),o+=this.renderer.codespan(c(i[2].trim(),!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),o+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),o+=this.renderer.del(this.output(i[1]));else if(i=this.rules.text.exec(e))e=e.substring(i[0].length),this.inRawBlock?o+=this.renderer.text(i[0]):o+=this.renderer.text(c(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else{if("@"===i[2])r="mailto:"+(n=c(i[0]));else{for(;l=i[0],i[0]=this.rules._backpedal.exec(i[0])[0],l!==i[0];);n=c(i[0]),r="www."===i[1]?"http://"+n:n}e=e.substring(i[0].length),o+=this.renderer.link(r,null,n)}return o},h.escapes=function(e){return e?e.replace(h.rules._escapes,"$1"):e},h.prototype.outputLink=function(e,t){var n=t.href,r=t.title?c(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,c(e[1]))},h.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},h.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,s=0;s<r;s++)t=e.charCodeAt(s),.5<Math.random()&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},r.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?'<pre><code class="'+this.options.langPrefix+c(t,!0)+'">'+(n?e:c(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:c(e,!0))+"</code></pre>"},r.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},r.prototype.html=function(e){return e},r.prototype.heading=function(e,t,n){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+n.toLowerCase().replace(/[^\w]+/g,"-")+'">'+e+"</h"+t+">\n":"<h"+t+">"+e+"</h"+t+">\n"},r.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},r.prototype.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+r+">\n"},r.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},r.prototype.checkbox=function(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},r.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},r.prototype.table=function(e,t){return t&&(t="<tbody>"+t+"</tbody>"),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"},r.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},r.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"</"+n+">\n"},r.prototype.strong=function(e){return"<strong>"+e+"</strong>"},r.prototype.em=function(e){return"<em>"+e+"</em>"},r.prototype.codespan=function(e){return"<code>"+e+"</code>"},r.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},r.prototype.del=function(e){return"<del>"+e+"</del>"},r.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(u(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return n}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return n}this.options.baseUrl&&!o.test(e)&&(e=i(this.options.baseUrl,e));try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return n}var s='<a href="'+c(e)+'"';return t&&(s+=' title="'+t+'"'),s+=">"+n+"</a>"},r.prototype.image=function(e,t,n){this.options.baseUrl&&!o.test(e)&&(e=i(this.options.baseUrl,e));var r='<img src="'+e+'" alt="'+n+'"';return t&&(r+=' title="'+t+'"'),r+=this.options.xhtml?"/>":">"},r.prototype.text=function(e){return e},s.prototype.strong=s.prototype.em=s.prototype.codespan=s.prototype.del=s.prototype.text=function(e){return e},s.prototype.link=s.prototype.image=function(e,t,n){return""+n},s.prototype.br=function(){return""},p.parse=function(e,t){return new p(t).parse(e)},p.prototype.parse=function(e){this.inline=new h(e.links,this.options),this.inlineText=new h(e.links,f({},this.options,{renderer:new s})),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},p.prototype.next=function(){return this.token=this.tokens.pop()},p.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},p.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},p.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,u(this.inlineText.output(this.token.text)));case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,s="",i="";for(n="",e=0;e<this.token.header.length;e++)n+=this.renderer.tablecell(this.inline.output(this.token.header[e]),{header:!0,align:this.token.align[e]});for(s+=this.renderer.tablerow(n),e=0;e<this.token.cells.length;e++){for(t=this.token.cells[e],n="",r=0;r<t.length;r++)n+=this.renderer.tablecell(this.inline.output(t[r]),{header:!1,align:this.token.align[r]});i+=this.renderer.tablerow(n)}return this.renderer.table(s,i);case"blockquote_start":for(i="";"blockquote_end"!==this.next().type;)i+=this.tok();return this.renderer.blockquote(i);case"list_start":i="";for(var l=this.token.ordered,o=this.token.start;"list_end"!==this.next().type;)i+=this.tok();return this.renderer.list(i,l,o);case"list_item_start":i="";var a=this.token.loose;for(this.token.task&&(i+=this.renderer.checkbox(this.token.checked));"list_item_end"!==this.next().type;)i+=a||"text"!==this.token.type?this.tok():this.parseText();return this.renderer.listitem(i);case"html":return this.renderer.html(this.token.text);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}},c.escapeTest=/[&<>"']/,c.escapeReplace=/[&<>"']/g,c.replacements={"&":"&","<":"<",">":">",'"':""","'":"'"},c.escapeTestNoEncode=/[<>"']|&(?!#?\w+;)/,c.escapeReplaceNoEncode=/[<>"']|&(?!#?\w+;)/g;var l={},o=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function g(){}function f(e){for(var t,n,r=1;r<arguments.length;r++)for(n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function x(e,t){var n=e.replace(/\|/g,function(e,t,n){for(var r=!1,s=t;0<=--s&&"\\"===n[s];)r=!r;return r?"|":" |"}).split(/ \|/),r=0;if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,"|");return n}function y(e,t,n){if(0===e.length)return"";for(var r=0;r<e.length;){var s=e.charAt(e.length-r-1);if(s!==t||n){if(s===t||!n)break;r++}else r++}return e.substr(0,e.length-r)}function d(e,n,r){if(null==e)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");if(r||"function"==typeof n){r||(r=n,n=null);var s,i,l=(n=f({},d.defaults,n||{})).highlight,t=0;try{s=a.lex(e,n)}catch(e){return r(e)}i=s.length;var o=function(t){if(t)return n.highlight=l,r(t);var e;try{e=p.parse(s,n)}catch(e){t=e}return n.highlight=l,t?r(t):r(null,e)};if(!l||l.length<3)return o();if(delete n.highlight,!i)return o();for(;t<s.length;t++)!function(n){"code"!==n.type?--i||o():l(n.text,n.lang,function(e,t){return e?o(e):null==t||t===n.text?--i||o():(n.text=t,n.escaped=!0,void(--i||o()))})}(s[t])}else try{return n&&(n=f({},d.defaults,n)),p.parse(a.lex(e,n),n)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",(n||d.defaults).silent)return"<p>An error occurred:</p><pre>"+c(e.message+"",!0)+"</pre>";throw e}}g.exec=g,d.options=d.setOptions=function(e){return f(d.defaults,e),d},d.getDefaults=function(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:new r,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tables:!0,xhtml:!1}},d.defaults=d.getDefaults(),d.Parser=p,d.parser=p.parse,d.Renderer=r,d.TextRenderer=s,d.Lexer=a,d.lexer=a.lex,d.InlineLexer=h,d.inlineLexer=h.output,d.parse=d,"undefined"!=typeof module&&"object"==typeof exports?module.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):e.marked=d}(this||("undefined"!=typeof window?window:global));
|
|
6
|
+
!function(e){"use strict";var k={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:f,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,nptable:f,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:f,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,text:/^[^\n]+/};function a(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||b.defaults,this.rules=k.normal,this.options.pedantic?this.rules=k.pedantic:this.options.gfm&&(this.options.tables?this.rules=k.tables:this.rules=k.gfm)}k._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,k._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,k.def=i(k.def).replace("label",k._label).replace("title",k._title).getRegex(),k.bullet=/(?:[*+-]|\d{1,9}\.)/,k.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,k.item=i(k.item,"gm").replace(/bull/g,k.bullet).getRegex(),k.list=i(k.list).replace(/bull/g,k.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+k.def.source+")").getRegex(),k._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",k._comment=/<!--(?!-?>)[\s\S]*?-->/,k.html=i(k.html,"i").replace("comment",k._comment).replace("tag",k._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),k.paragraph=i(k.paragraph).replace("hr",k.hr).replace("heading",k.heading).replace("lheading",k.lheading).replace("tag",k._tag).getRegex(),k.blockquote=i(k.blockquote).replace("paragraph",k.paragraph).getRegex(),k.normal=d({},k),k.gfm=d({},k.normal,{fences:/^ {0,3}(`{3,}|~{3,})([^`\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),k.gfm.paragraph=i(k.paragraph).replace("(?!","(?!"+k.gfm.fences.source.replace("\\1","\\2")+"|"+k.list.source.replace("\\1","\\3")+"|").getRegex(),k.tables=d({},k.gfm,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/}),k.pedantic=d({},k.normal,{html:i("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",k._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/}),a.rules=k,a.lex=function(e,t){return new a(t).lex(e)},a.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},a.prototype.token=function(e,t){var n,r,s,i,l,o,a,h,p,u,c,g,f,d,m,b;for(e=e.replace(/^ +$/gm,"");e;)if((s=this.rules.newline.exec(e))&&(e=e.substring(s[0].length),1<s[0].length&&this.tokens.push({type:"space"})),s=this.rules.code.exec(e))e=e.substring(s[0].length),s=s[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?s:y(s,"\n")});else if(s=this.rules.fences.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"code",lang:s[2]?s[2].trim():s[2],text:s[3]||""});else if(s=this.rules.heading.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"heading",depth:s[1].length,text:s[2]});else if((s=this.rules.nptable.exec(e))&&(o={type:"table",header:x(s[1].replace(/^ *| *\| *$/g,"")),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3]?s[3].replace(/\n$/,"").split("\n"):[]}).header.length===o.align.length){for(e=e.substring(s[0].length),c=0;c<o.align.length;c++)/^ *-+: *$/.test(o.align[c])?o.align[c]="right":/^ *:-+: *$/.test(o.align[c])?o.align[c]="center":/^ *:-+ *$/.test(o.align[c])?o.align[c]="left":o.align[c]=null;for(c=0;c<o.cells.length;c++)o.cells[c]=x(o.cells[c],o.header.length);this.tokens.push(o)}else if(s=this.rules.hr.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"hr"});else if(s=this.rules.blockquote.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"blockquote_start"}),s=s[0].replace(/^ *> ?/gm,""),this.token(s,t),this.tokens.push({type:"blockquote_end"});else if(s=this.rules.list.exec(e)){for(e=e.substring(s[0].length),a={type:"list_start",ordered:d=1<(i=s[2]).length,start:d?+i:"",loose:!1},this.tokens.push(a),n=!(h=[]),f=(s=s[0].match(this.rules.item)).length,c=0;c<f;c++)u=(o=s[c]).length,~(o=o.replace(/^ *([*+-]|\d+\.) */,"")).indexOf("\n ")&&(u-=o.length,o=this.options.pedantic?o.replace(/^ {1,4}/gm,""):o.replace(new RegExp("^ {1,"+u+"}","gm"),"")),c!==f-1&&(l=k.bullet.exec(s[c+1])[0],(1<i.length?1===l.length:1<l.length||this.options.smartLists&&l!==i)&&(e=s.slice(c+1).join("\n")+e,c=f-1)),r=n||/\n\n(?!\s*$)/.test(o),c!==f-1&&(n="\n"===o.charAt(o.length-1),r||(r=n)),r&&(a.loose=!0),b=void 0,(m=/^\[[ xX]\] /.test(o))&&(b=" "!==o[1],o=o.replace(/^\[[ xX]\] +/,"")),p={type:"list_item_start",task:m,checked:b,loose:r},h.push(p),this.tokens.push(p),this.token(o,!1),this.tokens.push({type:"list_item_end"});if(a.loose)for(f=h.length,c=0;c<f;c++)h[c].loose=!0;this.tokens.push({type:"list_end"})}else if(s=this.rules.html.exec(e))e=e.substring(s[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===s[1]||"script"===s[1]||"style"===s[1]),text:s[0]});else if(t&&(s=this.rules.def.exec(e)))e=e.substring(s[0].length),s[3]&&(s[3]=s[3].substring(1,s[3].length-1)),g=s[1].toLowerCase().replace(/\s+/g," "),this.tokens.links[g]||(this.tokens.links[g]={href:s[2],title:s[3]});else if((s=this.rules.table.exec(e))&&(o={type:"table",header:x(s[1].replace(/^ *| *\| *$/g,"")),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3]?s[3].replace(/\n$/,"").split("\n"):[]}).header.length===o.align.length){for(e=e.substring(s[0].length),c=0;c<o.align.length;c++)/^ *-+: *$/.test(o.align[c])?o.align[c]="right":/^ *:-+: *$/.test(o.align[c])?o.align[c]="center":/^ *:-+ *$/.test(o.align[c])?o.align[c]="left":o.align[c]=null;for(c=0;c<o.cells.length;c++)o.cells[c]=x(o.cells[c].replace(/^ *\| *| *\| *$/g,""),o.header.length);this.tokens.push(o)}else if(s=this.rules.lheading.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"heading",depth:"="===s[2]?1:2,text:s[1]});else if(t&&(s=this.rules.paragraph.exec(e)))e=e.substring(s[0].length),this.tokens.push({type:"paragraph",text:"\n"===s[1].charAt(s[1].length-1)?s[1].slice(0,-1):s[1]});else if(s=this.rules.text.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"text",text:s[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens};var n={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:f,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,em:/^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:f,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/};function p(e,t){if(this.options=t||b.defaults,this.links=e,this.rules=n.normal,this.renderer=this.options.renderer||new r,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.pedantic?this.rules=n.pedantic:this.options.gfm&&(this.options.breaks?this.rules=n.breaks:this.rules=n.gfm)}function r(e){this.options=e||b.defaults}function s(){}function h(e){this.tokens=[],this.token=null,this.options=e||b.defaults,this.options.renderer=this.options.renderer||new r,this.renderer=this.options.renderer,this.renderer.options=this.options,this.slugger=new t}function t(){this.seen={}}function u(e,t){if(t){if(u.escapeTest.test(e))return e.replace(u.escapeReplace,function(e){return u.replacements[e]})}else if(u.escapeTestNoEncode.test(e))return e.replace(u.escapeReplaceNoEncode,function(e){return u.replacements[e]});return e}function c(e){return e.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function i(n,e){return n=n.source||n,e=e||"",{replace:function(e,t){return t=(t=t.source||t).replace(/(^|[^\[])\^/g,"$1"),n=n.replace(e,t),this},getRegex:function(){return new RegExp(n,e)}}}function l(e,t,n){if(e){try{var r=decodeURIComponent(c(n)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return null}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return null}t&&!g.test(n)&&(n=function(e,t){o[" "+e]||(/^[^:]+:\/*[^/]*$/.test(e)?o[" "+e]=e+"/":o[" "+e]=y(e,"/",!0));return e=o[" "+e],"//"===t.slice(0,2)?e.replace(/:[\s\S]*/,":")+t:"/"===t.charAt(0)?e.replace(/(:\/*[^/]*)[\s\S]*/,"$1")+t:e+t}(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(e){return null}return n}n._punctuation="!\"#$%&'()*+,\\-./:;<=>?@\\[^_{|}~",n.em=i(n.em).replace(/punctuation/g,n._punctuation).getRegex(),n._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,n._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,n._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,n.autolink=i(n.autolink).replace("scheme",n._scheme).replace("email",n._email).getRegex(),n._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,n.tag=i(n.tag).replace("comment",k._comment).replace("attribute",n._attribute).getRegex(),n._label=/(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|`(?!`)|[^\[\]\\`])*?/,n._href=/\s*(<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*)/,n._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,n.link=i(n.link).replace("label",n._label).replace("href",n._href).replace("title",n._title).getRegex(),n.reflink=i(n.reflink).replace("label",n._label).getRegex(),n.normal=d({},n),n.pedantic=d({},n.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:i(/^!?\[(label)\]\((.*?)\)/).replace("label",n._label).getRegex(),reflink:i(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",n._label).getRegex()}),n.gfm=d({},n.normal,{escape:i(n.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),n.gfm.url=i(n.gfm.url,"i").replace("email",n.gfm._extended_email).getRegex(),n.breaks=d({},n.gfm,{br:i(n.br).replace("{2,}","*").getRegex(),text:i(n.gfm.text).replace(/\{2,\}/g,"*").getRegex()}),p.rules=n,p.output=function(e,t,n){return new p(t,n).output(e)},p.prototype.output=function(e){for(var t,n,r,s,i,l,o="";e;)if(i=this.rules.escape.exec(e))e=e.substring(i[0].length),o+=u(i[1]);else if(i=this.rules.tag.exec(e))!this.inLink&&/^<a /i.test(i[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(i[0])&&(this.inLink=!1),!this.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(i[0])?this.inRawBlock=!0:this.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(i[0])&&(this.inRawBlock=!1),e=e.substring(i[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):u(i[0]):i[0];else if(i=this.rules.link.exec(e)){var a=m(i[2],"()");if(-1<a){var h=i[0].length-(i[2].length-a)-(i[3]||"").length;i[2]=i[2].substring(0,a),i[0]=i[0].substring(0,h).trim(),i[3]=""}e=e.substring(i[0].length),this.inLink=!0,r=i[2],s=this.options.pedantic?(t=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r))?(r=t[1],t[3]):"":i[3]?i[3].slice(1,-1):"",r=r.trim().replace(/^<([\s\S]*)>$/,"$1"),o+=this.outputLink(i,{href:p.escapes(r),title:p.escapes(s)}),this.inLink=!1}else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){o+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),o+=this.renderer.strong(this.output(i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),o+=this.renderer.em(this.output(i[6]||i[5]||i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),o+=this.renderer.codespan(u(i[2].trim(),!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),o+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),o+=this.renderer.del(this.output(i[1]));else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),r="@"===i[2]?"mailto:"+(n=u(this.mangle(i[1]))):n=u(i[1]),o+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.text.exec(e))e=e.substring(i[0].length),this.inRawBlock?o+=this.renderer.text(i[0]):o+=this.renderer.text(u(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else{if("@"===i[2])r="mailto:"+(n=u(i[0]));else{for(;l=i[0],i[0]=this.rules._backpedal.exec(i[0])[0],l!==i[0];);n=u(i[0]),r="www."===i[1]?"http://"+n:n}e=e.substring(i[0].length),o+=this.renderer.link(r,null,n)}return o},p.escapes=function(e){return e?e.replace(p.rules._escapes,"$1"):e},p.prototype.outputLink=function(e,t){var n=t.href,r=t.title?u(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,u(e[1]))},p.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},p.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,s=0;s<r;s++)t=e.charCodeAt(s),.5<Math.random()&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},r.prototype.code=function(e,t,n){var r=(t||"").match(/\S*/)[0];if(this.options.highlight){var s=this.options.highlight(e,r);null!=s&&s!==e&&(n=!0,e=s)}return r?'<pre><code class="'+this.options.langPrefix+u(r,!0)+'">'+(n?e:u(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:u(e,!0))+"</code></pre>"},r.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},r.prototype.html=function(e){return e},r.prototype.heading=function(e,t,n,r){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+r.slug(n)+'">'+e+"</h"+t+">\n":"<h"+t+">"+e+"</h"+t+">\n"},r.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},r.prototype.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+r+">\n"},r.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},r.prototype.checkbox=function(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},r.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},r.prototype.table=function(e,t){return t&&(t="<tbody>"+t+"</tbody>"),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"},r.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},r.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"</"+n+">\n"},r.prototype.strong=function(e){return"<strong>"+e+"</strong>"},r.prototype.em=function(e){return"<em>"+e+"</em>"},r.prototype.codespan=function(e){return"<code>"+e+"</code>"},r.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},r.prototype.del=function(e){return"<del>"+e+"</del>"},r.prototype.link=function(e,t,n){if(null===(e=l(this.options.sanitize,this.options.baseUrl,e)))return n;var r='<a href="'+u(e)+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>"},r.prototype.image=function(e,t,n){if(null===(e=l(this.options.sanitize,this.options.baseUrl,e)))return n;var r='<img src="'+e+'" alt="'+n+'"';return t&&(r+=' title="'+t+'"'),r+=this.options.xhtml?"/>":">"},r.prototype.text=function(e){return e},s.prototype.strong=s.prototype.em=s.prototype.codespan=s.prototype.del=s.prototype.text=function(e){return e},s.prototype.link=s.prototype.image=function(e,t,n){return""+n},s.prototype.br=function(){return""},h.parse=function(e,t){return new h(t).parse(e)},h.prototype.parse=function(e){this.inline=new p(e.links,this.options),this.inlineText=new p(e.links,d({},this.options,{renderer:new s})),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},h.prototype.next=function(){return this.token=this.tokens.pop()},h.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},h.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},h.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,c(this.inlineText.output(this.token.text)),this.slugger);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,s="",i="";for(n="",e=0;e<this.token.header.length;e++)n+=this.renderer.tablecell(this.inline.output(this.token.header[e]),{header:!0,align:this.token.align[e]});for(s+=this.renderer.tablerow(n),e=0;e<this.token.cells.length;e++){for(t=this.token.cells[e],n="",r=0;r<t.length;r++)n+=this.renderer.tablecell(this.inline.output(t[r]),{header:!1,align:this.token.align[r]});i+=this.renderer.tablerow(n)}return this.renderer.table(s,i);case"blockquote_start":for(i="";"blockquote_end"!==this.next().type;)i+=this.tok();return this.renderer.blockquote(i);case"list_start":i="";for(var l=this.token.ordered,o=this.token.start;"list_end"!==this.next().type;)i+=this.tok();return this.renderer.list(i,l,o);case"list_item_start":i="";var a=this.token.loose,h=this.token.checked,p=this.token.task;for(this.token.task&&(i+=this.renderer.checkbox(h));"list_item_end"!==this.next().type;)i+=a||"text"!==this.token.type?this.tok():this.parseText();return this.renderer.listitem(i,p,h);case"html":return this.renderer.html(this.token.text);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText());default:var u='Token with "'+this.token.type+'" type was not found.';if(!this.options.silent)throw new Error(u);console.log(u)}},t.prototype.slug=function(e){var t=e.toLowerCase().trim().replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t))for(var n=t;this.seen[n]++,t=n+"-"+this.seen[n],this.seen.hasOwnProperty(t););return this.seen[t]=0,t},u.escapeTest=/[&<>"']/,u.escapeReplace=/[&<>"']/g,u.replacements={"&":"&","<":"<",">":">",'"':""","'":"'"},u.escapeTestNoEncode=/[<>"']|&(?!#?\w+;)/,u.escapeReplaceNoEncode=/[<>"']|&(?!#?\w+;)/g;var o={},g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(){}function d(e){for(var t,n,r=1;r<arguments.length;r++)for(n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function x(e,t){var n=e.replace(/\|/g,function(e,t,n){for(var r=!1,s=t;0<=--s&&"\\"===n[s];)r=!r;return r?"|":" |"}).split(/ \|/),r=0;if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,"|");return n}function y(e,t,n){if(0===e.length)return"";for(var r=0;r<e.length;){var s=e.charAt(e.length-r-1);if(s!==t||n){if(s===t||!n)break;r++}else r++}return e.substr(0,e.length-r)}function m(e,t){if(-1===e.indexOf(t[1]))return-1;for(var n=0,r=0;r<e.length;r++)if("\\"===e[r])r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&--n<0)return r;return-1}function b(e,n,r){if(null==e)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");if(r||"function"==typeof n){r||(r=n,n=null);var s,i,l=(n=d({},b.defaults,n||{})).highlight,t=0;try{s=a.lex(e,n)}catch(e){return r(e)}i=s.length;var o=function(t){if(t)return n.highlight=l,r(t);var e;try{e=h.parse(s,n)}catch(e){t=e}return n.highlight=l,t?r(t):r(null,e)};if(!l||l.length<3)return o();if(delete n.highlight,!i)return o();for(;t<s.length;t++)!function(n){"code"!==n.type?--i||o():l(n.text,n.lang,function(e,t){return e?o(e):null==t||t===n.text?--i||o():(n.text=t,n.escaped=!0,void(--i||o()))})}(s[t])}else try{return n&&(n=d({},b.defaults,n)),h.parse(a.lex(e,n),n)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",(n||b.defaults).silent)return"<p>An error occurred:</p><pre>"+u(e.message+"",!0)+"</pre>";throw e}}f.exec=f,b.options=b.setOptions=function(e){return d(b.defaults,e),b},b.getDefaults=function(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:new r,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tables:!0,xhtml:!1}},b.defaults=b.getDefaults(),b.Parser=h,b.parser=h.parse,b.Renderer=r,b.TextRenderer=s,b.Lexer=a,b.lexer=a.lex,b.InlineLexer=p,b.inlineLexer=p.output,b.Slugger=t,b.parse=b,"undefined"!=typeof module&&"object"==typeof exports?module.exports=b:"function"==typeof define&&define.amd?define(function(){return b}):e.marked=b}(this||("undefined"!=typeof window?window:global));
|
package/package.json
CHANGED
|
@@ -2,10 +2,16 @@
|
|
|
2
2
|
"name": "marked",
|
|
3
3
|
"description": "A markdown parser built for speed",
|
|
4
4
|
"author": "Christopher Jeffrey",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.6.2",
|
|
6
6
|
"main": "./lib/marked.js",
|
|
7
7
|
"bin": "./bin/marked",
|
|
8
8
|
"man": "./man/marked.1",
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"lib/",
|
|
12
|
+
"man/",
|
|
13
|
+
"marked.min.js"
|
|
14
|
+
],
|
|
9
15
|
"repository": "git://github.com/markedjs/marked.git",
|
|
10
16
|
"homepage": "https://marked.js.org",
|
|
11
17
|
"bugs": {
|
|
@@ -24,21 +30,20 @@
|
|
|
24
30
|
],
|
|
25
31
|
"devDependencies": {
|
|
26
32
|
"commonmark": "0.x",
|
|
27
|
-
"eslint": "^
|
|
28
|
-
"eslint-config-standard": "^
|
|
29
|
-
"eslint-plugin-import": "^2.
|
|
30
|
-
"eslint-plugin-node": "^
|
|
31
|
-
"eslint-plugin-promise": "^
|
|
32
|
-
"eslint-plugin-standard": "^
|
|
33
|
+
"eslint": "^5.15.1",
|
|
34
|
+
"eslint-config-standard": "^12.0.0",
|
|
35
|
+
"eslint-plugin-import": "^2.16.0",
|
|
36
|
+
"eslint-plugin-node": "^8.0.1",
|
|
37
|
+
"eslint-plugin-promise": "^4.0.1",
|
|
38
|
+
"eslint-plugin-standard": "^4.0.0",
|
|
33
39
|
"eslint-plugin-vuln-regex-detector": "^1.0.4",
|
|
34
|
-
"front-matter": "^
|
|
35
|
-
"glob-to-regexp": "0.
|
|
36
|
-
"@markedjs/html-differ": "^2.0.
|
|
37
|
-
"jasmine": "^3.
|
|
38
|
-
"jasmine2-custom-message": "^0.9.3",
|
|
40
|
+
"front-matter": "^3.0.1",
|
|
41
|
+
"glob-to-regexp": "^0.4.0",
|
|
42
|
+
"@markedjs/html-differ": "^2.0.1",
|
|
43
|
+
"jasmine": "^3.3.1",
|
|
39
44
|
"markdown": "0.x",
|
|
40
45
|
"markdown-it": "8.x",
|
|
41
|
-
"uglify-js": "^3.4.
|
|
46
|
+
"uglify-js": "^3.4.9"
|
|
42
47
|
},
|
|
43
48
|
"scripts": {
|
|
44
49
|
"test": "jasmine --config=jasmine.json",
|
|
@@ -50,6 +55,7 @@
|
|
|
50
55
|
"test:old": "node test",
|
|
51
56
|
"test:lint": "eslint bin/marked .",
|
|
52
57
|
"test:redos": "eslint --plugin vuln-regex-detector --rule '\"vuln-regex-detector/no-vuln-regex\": 2' lib/marked.js",
|
|
58
|
+
"test:node4": "npx node@4 ./node_modules/jasmine/bin/jasmine.js --config=jasmine.json",
|
|
53
59
|
"bench": "node test --bench",
|
|
54
60
|
"lint": "eslint --fix bin/marked .",
|
|
55
61
|
"build": "uglifyjs lib/marked.js -cm --comments /Copyright/ -o marked.min.js",
|
package/.editorconfig
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
root = true
|
|
2
|
-
|
|
3
|
-
[*.{json,js}]
|
|
4
|
-
charset = utf-8
|
|
5
|
-
end_of_line = lf
|
|
6
|
-
insert_final_newline = true
|
|
7
|
-
indent_style = space
|
|
8
|
-
indent_size = 2
|
|
9
|
-
|
|
10
|
-
[*.md, !test/*.md]
|
|
11
|
-
charset = utf-8
|
|
12
|
-
end_of_line = lf
|
|
13
|
-
insert_final_newline = true
|
|
14
|
-
trim_trailing_whitespace = true
|
|
15
|
-
indent_style = tab
|
|
16
|
-
indent_size = 4
|
package/.eslintignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
*.min.js
|
package/.eslintrc.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "standard",
|
|
3
|
-
"plugins": [
|
|
4
|
-
"standard"
|
|
5
|
-
],
|
|
6
|
-
"parserOptions": { "ecmaVersion": 5 },
|
|
7
|
-
"rules": {
|
|
8
|
-
"semi": "off",
|
|
9
|
-
"indent": ["warn", 2, {
|
|
10
|
-
"VariableDeclarator": { "var": 2 },
|
|
11
|
-
"SwitchCase": 1,
|
|
12
|
-
"outerIIFEBody": 0
|
|
13
|
-
}],
|
|
14
|
-
"space-before-function-paren": "off",
|
|
15
|
-
"operator-linebreak": ["error", "before", { "overrides": { "=": "after" } }],
|
|
16
|
-
"no-cond-assign": "off",
|
|
17
|
-
"no-useless-escape": "off",
|
|
18
|
-
"no-return-assign": "off",
|
|
19
|
-
"one-var": "off",
|
|
20
|
-
"no-control-regex": "off"
|
|
21
|
-
},
|
|
22
|
-
"env": {
|
|
23
|
-
"node": true,
|
|
24
|
-
"browser": true,
|
|
25
|
-
"amd": true,
|
|
26
|
-
"jasmine": true
|
|
27
|
-
}
|
|
28
|
-
}
|
package/.travis.yml
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
language: node_js
|
|
2
|
-
|
|
3
|
-
jobs:
|
|
4
|
-
fast_finish: true
|
|
5
|
-
allow_failures:
|
|
6
|
-
- stage: security scan 🔐
|
|
7
|
-
|
|
8
|
-
include:
|
|
9
|
-
- stage: unit tests 👩🏽💻
|
|
10
|
-
script: npm run test:unit
|
|
11
|
-
node_js: lts/*
|
|
12
|
-
|
|
13
|
-
- stage: spec tests 👩🏽💻
|
|
14
|
-
script: npm run test:specs
|
|
15
|
-
node_js: v0.10
|
|
16
|
-
- node_js: v4
|
|
17
|
-
- node_js: lts/*
|
|
18
|
-
- node_js: node
|
|
19
|
-
|
|
20
|
-
- stage: lint ✨
|
|
21
|
-
script: npm run test:lint
|
|
22
|
-
node_js: lts/*
|
|
23
|
-
|
|
24
|
-
- stage: minify 🗜️
|
|
25
|
-
script: |
|
|
26
|
-
npm run build
|
|
27
|
-
if ! git diff --quiet; then
|
|
28
|
-
git config --global user.email "travis@travis-ci.org"
|
|
29
|
-
git config --global user.name "Travis-CI"
|
|
30
|
-
git config credential.helper "store --file=.git/credentials"
|
|
31
|
-
echo "https://${GITHUB_TOKEN}:@github.com" > .git/credentials
|
|
32
|
-
git commit -am '🗜️ minify [skip ci]'
|
|
33
|
-
git push origin HEAD:${TRAVIS_BRANCH}
|
|
34
|
-
fi
|
|
35
|
-
node_js: lts/*
|
|
36
|
-
if: branch = master AND type = push
|
|
37
|
-
|
|
38
|
-
- stage: security scan 🔐
|
|
39
|
-
script: npm run test:redos
|
|
40
|
-
node_js: lts/*
|
|
41
|
-
|
|
42
|
-
cache:
|
|
43
|
-
directories:
|
|
44
|
-
- node_modules
|
|
45
|
-
|
|
46
|
-
git:
|
|
47
|
-
depth: 3
|
package/Makefile
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
all:
|
|
2
|
-
@cp lib/marked.js marked.js
|
|
3
|
-
@uglifyjs --comments '/\*[^\0]+?Copyright[^\0]+?\*/' -o marked.min.js lib/marked.js
|
|
4
|
-
|
|
5
|
-
clean:
|
|
6
|
-
@rm marked.js
|
|
7
|
-
@rm marked.min.js
|
|
8
|
-
|
|
9
|
-
bench:
|
|
10
|
-
@node test --bench
|
|
11
|
-
|
|
12
|
-
man/marked.1.txt:
|
|
13
|
-
groff -man -Tascii man/marked.1 | col -b > man/marked.1.txt
|
|
14
|
-
|
|
15
|
-
.PHONY: clean all
|
package/bower.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "marked",
|
|
3
|
-
"homepage": "https://github.com/markedjs/marked",
|
|
4
|
-
"authors": [
|
|
5
|
-
"Christopher Jeffrey <chjjeffrey@gmail.com>"
|
|
6
|
-
],
|
|
7
|
-
"description": "A markdown parser built for speed",
|
|
8
|
-
"keywords": [
|
|
9
|
-
"markdown",
|
|
10
|
-
"markup",
|
|
11
|
-
"html"
|
|
12
|
-
],
|
|
13
|
-
"main": "lib/marked.js",
|
|
14
|
-
"license": "MIT",
|
|
15
|
-
"ignore": [
|
|
16
|
-
"**/.*",
|
|
17
|
-
"node_modules",
|
|
18
|
-
"bower_components",
|
|
19
|
-
"app/bower_components",
|
|
20
|
-
"test",
|
|
21
|
-
"tests"
|
|
22
|
-
]
|
|
23
|
-
}
|
package/component.json
DELETED
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./lib/marked');
|