marked 0.3.15 → 0.3.19

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/lib/marked.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * marked - a markdown parser
3
3
  * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
4
- * https://github.com/chjj/marked
4
+ * https://github.com/markedjs/marked
5
5
  */
6
6
 
7
- ;(function() {
7
+ ;(function(root) {
8
8
  'use strict';
9
9
 
10
10
  /**
@@ -30,45 +30,45 @@ var block = {
30
30
 
31
31
  block._label = /(?:\\[\[\]]|[^\[\]])+/;
32
32
  block._title = /(?:"(?:\\"|[^"]|"[^"\n]*")*"|'\n?(?:[^'\n]+\n?)*'|\([^()]*\))/;
33
- block.def = replace(block.def)
34
- ('label', block._label)
35
- ('title', block._title)
36
- ();
33
+ block.def = edit(block.def)
34
+ .replace('label', block._label)
35
+ .replace('title', block._title)
36
+ .getRegex();
37
37
 
38
38
  block.bullet = /(?:[*+-]|\d+\.)/;
39
39
  block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;
40
- block.item = replace(block.item, 'gm')
41
- (/bull/g, block.bullet)
42
- ();
40
+ block.item = edit(block.item, 'gm')
41
+ .replace(/bull/g, block.bullet)
42
+ .getRegex();
43
43
 
44
- block.list = replace(block.list)
45
- (/bull/g, block.bullet)
46
- ('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))')
47
- ('def', '\\n+(?=' + block.def.source + ')')
48
- ();
44
+ block.list = edit(block.list)
45
+ .replace(/bull/g, block.bullet)
46
+ .replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))')
47
+ .replace('def', '\\n+(?=' + block.def.source + ')')
48
+ .getRegex();
49
49
 
50
50
  block._tag = '(?!(?:'
51
51
  + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code'
52
52
  + '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo'
53
53
  + '|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b';
54
54
 
55
- block.html = replace(block.html)
56
- ('comment', /<!--[\s\S]*?-->/)
57
- ('closed', /<(tag)[\s\S]+?<\/\1>/)
58
- ('closing', /<tag(?:"[^"]*"|'[^']*'|\s[^'"\/>]*)*?\/?>/)
59
- (/tag/g, block._tag)
60
- ();
55
+ block.html = edit(block.html)
56
+ .replace('comment', /<!--[\s\S]*?-->/)
57
+ .replace('closed', /<(tag)[\s\S]+?<\/\1>/)
58
+ .replace('closing', /<tag(?:"[^"]*"|'[^']*'|\s[^'"\/>\s]*)*?\/?>/)
59
+ .replace(/tag/g, block._tag)
60
+ .getRegex();
61
61
 
62
- block.paragraph = replace(block.paragraph)
63
- ('hr', block.hr)
64
- ('heading', block.heading)
65
- ('lheading', block.lheading)
66
- ('tag', '<' + block._tag)
67
- ();
62
+ block.paragraph = edit(block.paragraph)
63
+ .replace('hr', block.hr)
64
+ .replace('heading', block.heading)
65
+ .replace('lheading', block.lheading)
66
+ .replace('tag', '<' + block._tag)
67
+ .getRegex();
68
68
 
69
- block.blockquote = replace(block.blockquote)
70
- ('paragraph', block.paragraph)
71
- ();
69
+ block.blockquote = edit(block.blockquote)
70
+ .replace('paragraph', block.paragraph)
71
+ .getRegex();
72
72
 
73
73
  /**
74
74
  * Normal Block Grammar
@@ -86,11 +86,11 @@ block.gfm = merge({}, block.normal, {
86
86
  heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/
87
87
  });
88
88
 
89
- block.gfm.paragraph = replace(block.paragraph)
90
- ('(?!', '(?!'
89
+ block.gfm.paragraph = edit(block.paragraph)
90
+ .replace('(?!', '(?!'
91
91
  + block.gfm.fences.source.replace('\\1', '\\2') + '|'
92
92
  + block.list.source.replace('\\1', '\\3') + '|')
93
- ();
93
+ .getRegex();
94
94
 
95
95
  /**
96
96
  * GFM + Tables Block Grammar
@@ -154,17 +154,18 @@ Lexer.prototype.lex = function(src) {
154
154
  */
155
155
 
156
156
  Lexer.prototype.token = function(src, top) {
157
- var src = src.replace(/^ +$/gm, '')
158
- , next
159
- , loose
160
- , cap
161
- , bull
162
- , b
163
- , item
164
- , space
165
- , i
166
- , tag
167
- , l;
157
+ src = src.replace(/^ +$/gm, '');
158
+ var next,
159
+ loose,
160
+ cap,
161
+ bull,
162
+ b,
163
+ item,
164
+ space,
165
+ i,
166
+ tag,
167
+ l,
168
+ isordered;
168
169
 
169
170
  while (src) {
170
171
  // newline
@@ -279,10 +280,12 @@ Lexer.prototype.token = function(src, top) {
279
280
  if (cap = this.rules.list.exec(src)) {
280
281
  src = src.substring(cap[0].length);
281
282
  bull = cap[2];
283
+ isordered = bull.length > 1;
282
284
 
283
285
  this.tokens.push({
284
286
  type: 'list_start',
285
- ordered: bull.length > 1
287
+ ordered: isordered,
288
+ start: isordered ? +bull : ''
286
289
  });
287
290
 
288
291
  // Get each top-level item.
@@ -366,7 +369,7 @@ Lexer.prototype.token = function(src, top) {
366
369
  // def
367
370
  if (top && (cap = this.rules.def.exec(src))) {
368
371
  src = src.substring(cap[0].length);
369
- if (cap[3]) cap[3] = cap[3].substring(1,cap[3].length-1);
372
+ if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
370
373
  tag = cap[1].toLowerCase();
371
374
  if (!this.tokens.links[tag]) {
372
375
  this.tokens.links[tag] = {
@@ -446,8 +449,7 @@ Lexer.prototype.token = function(src, top) {
446
449
  }
447
450
 
448
451
  if (src) {
449
- throw new
450
- Error('Infinite loop on byte: ' + src.charCodeAt(0));
452
+ throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
451
453
  }
452
454
  }
453
455
 
@@ -462,13 +464,13 @@ var inline = {
462
464
  escape: /^\\([\\`*{}\[\]()#+\-.!_>])/,
463
465
  autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
464
466
  url: noop,
465
- tag: /^<!--[\s\S]*?-->|^<\/?[a-zA-Z0-9\-]+(?:"[^"]*"|'[^']*'|\s[^<'">\/]*)*?\/?>/,
467
+ tag: /^<!--[\s\S]*?-->|^<\/?[a-zA-Z0-9\-]+(?:"[^"]*"|'[^']*'|\s[^<'">\/\s]*)*?\/?>/,
466
468
  link: /^!?\[(inside)\]\(href\)/,
467
469
  reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/,
468
- nolink: /^!?\[((?:\[[^\]]*\]|\\[\[\]]|[^\[\]])*)\]/,
470
+ nolink: /^!?\[((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\]/,
469
471
  strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,
470
472
  em: /^_([^\s_](?:[^_]|__)+?[^\s_])_\b|^\*((?:\*\*|[^*])+?)\*(?!\*)/,
471
- code: /^(`+)(\s*)([\s\S]*?[^`]?)\2\1(?!`)/,
473
+ code: /^(`+)\s*([\s\S]*?[^`]?)\s*\1(?!`)/,
472
474
  br: /^ {2,}\n(?!\s*$)/,
473
475
  del: noop,
474
476
  text: /^[\s\S]+?(?=[\\<!\[`*]|\b_| {2,}\n|$)/
@@ -477,22 +479,22 @@ var inline = {
477
479
  inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
478
480
  inline._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])?)+(?![-_])/;
479
481
 
480
- inline.autolink = replace(inline.autolink)
481
- ('scheme', inline._scheme)
482
- ('email', inline._email)
483
- ()
482
+ inline.autolink = edit(inline.autolink)
483
+ .replace('scheme', inline._scheme)
484
+ .replace('email', inline._email)
485
+ .getRegex()
484
486
 
485
- inline._inside = /(?:\[[^\]]*\]|\\[\[\]]|[^\[\]]|\](?=[^\[]*\]))*/;
487
+ inline._inside = /(?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]]|\](?=[^\[]*\]))*/;
486
488
  inline._href = /\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;
487
489
 
488
- inline.link = replace(inline.link)
489
- ('inside', inline._inside)
490
- ('href', inline._href)
491
- ();
490
+ inline.link = edit(inline.link)
491
+ .replace('inside', inline._inside)
492
+ .replace('href', inline._href)
493
+ .getRegex();
492
494
 
493
- inline.reflink = replace(inline.reflink)
494
- ('inside', inline._inside)
495
- ();
495
+ inline.reflink = edit(inline.reflink)
496
+ .replace('inside', inline._inside)
497
+ .getRegex();
496
498
 
497
499
  /**
498
500
  * Normal Inline Grammar
@@ -514,16 +516,16 @@ inline.pedantic = merge({}, inline.normal, {
514
516
  */
515
517
 
516
518
  inline.gfm = merge({}, inline.normal, {
517
- escape: replace(inline.escape)('])', '~|])')(),
518
- url: replace(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/)
519
- ('email', inline._email)
520
- (),
519
+ escape: edit(inline.escape).replace('])', '~|])').getRegex(),
520
+ url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/)
521
+ .replace('email', inline._email)
522
+ .getRegex(),
521
523
  _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
522
524
  del: /^~~(?=\S)([\s\S]*?\S)~~/,
523
- text: replace(inline.text)
524
- (']|', '~]|')
525
- ('|', '|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&\'*+/=?^_`{\\|}~-]+@|')
526
- ()
525
+ text: edit(inline.text)
526
+ .replace(']|', '~]|')
527
+ .replace('|', '|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&\'*+/=?^_`{\\|}~-]+@|')
528
+ .getRegex()
527
529
  });
528
530
 
529
531
  /**
@@ -531,8 +533,8 @@ inline.gfm = merge({}, inline.normal, {
531
533
  */
532
534
 
533
535
  inline.breaks = merge({}, inline.gfm, {
534
- br: replace(inline.br)('{2,}', '*')(),
535
- text: replace(inline.gfm.text)('{2,}', '*')()
536
+ br: edit(inline.br).replace('{2,}', '*').getRegex(),
537
+ text: edit(inline.gfm.text).replace('{2,}', '*').getRegex()
536
538
  });
537
539
 
538
540
  /**
@@ -543,12 +545,11 @@ function InlineLexer(links, options) {
543
545
  this.options = options || marked.defaults;
544
546
  this.links = links;
545
547
  this.rules = inline.normal;
546
- this.renderer = this.options.renderer || new Renderer;
548
+ this.renderer = this.options.renderer || new Renderer();
547
549
  this.renderer.options = this.options;
548
550
 
549
551
  if (!this.links) {
550
- throw new
551
- Error('Tokens array requires a `links` property.');
552
+ throw new Error('Tokens array requires a `links` property.');
552
553
  }
553
554
 
554
555
  if (this.options.gfm) {
@@ -582,11 +583,11 @@ InlineLexer.output = function(src, links, options) {
582
583
  */
583
584
 
584
585
  InlineLexer.prototype.output = function(src) {
585
- var out = ''
586
- , link
587
- , text
588
- , href
589
- , cap;
586
+ var out = '',
587
+ link,
588
+ text,
589
+ href,
590
+ cap;
590
591
 
591
592
  while (src) {
592
593
  // escape
@@ -691,7 +692,7 @@ InlineLexer.prototype.output = function(src) {
691
692
  // code
692
693
  if (cap = this.rules.code.exec(src)) {
693
694
  src = src.substring(cap[0].length);
694
- out += this.renderer.codespan(escape(cap[3].trim(), true));
695
+ out += this.renderer.codespan(escape(cap[2].trim(), true));
695
696
  continue;
696
697
  }
697
698
 
@@ -717,8 +718,7 @@ InlineLexer.prototype.output = function(src) {
717
718
  }
718
719
 
719
720
  if (src) {
720
- throw new
721
- Error('Infinite loop on byte: ' + src.charCodeAt(0));
721
+ throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
722
722
  }
723
723
  }
724
724
 
@@ -730,8 +730,8 @@ InlineLexer.prototype.output = function(src) {
730
730
  */
731
731
 
732
732
  InlineLexer.prototype.outputLink = function(cap, link) {
733
- var href = escape(link.href)
734
- , title = link.title ? escape(link.title) : null;
733
+ var href = escape(link.href),
734
+ title = link.title ? escape(link.title) : null;
735
735
 
736
736
  return cap[0].charAt(0) !== '!'
737
737
  ? this.renderer.link(href, title, this.output(cap[1]))
@@ -767,10 +767,10 @@ InlineLexer.prototype.smartypants = function(text) {
767
767
 
768
768
  InlineLexer.prototype.mangle = function(text) {
769
769
  if (!this.options.mangle) return text;
770
- var out = ''
771
- , l = text.length
772
- , i = 0
773
- , ch;
770
+ var out = '',
771
+ l = text.length,
772
+ i = 0,
773
+ ch;
774
774
 
775
775
  for (; i < l; i++) {
776
776
  ch = text.charCodeAt(i);
@@ -839,9 +839,10 @@ Renderer.prototype.hr = function() {
839
839
  return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
840
840
  };
841
841
 
842
- Renderer.prototype.list = function(body, ordered) {
843
- var type = ordered ? 'ol' : 'ul';
844
- return '<' + type + '>\n' + body + '</' + type + '>\n';
842
+ Renderer.prototype.list = function(body, ordered, start) {
843
+ var type = ordered ? 'ol' : 'ul',
844
+ startatt = (ordered && start !== 1) ? (' start="' + start + '"') : '';
845
+ return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
845
846
  };
846
847
 
847
848
  Renderer.prototype.listitem = function(text) {
@@ -970,7 +971,7 @@ function Parser(options) {
970
971
  this.tokens = [];
971
972
  this.token = null;
972
973
  this.options = options || marked.defaults;
973
- this.options.renderer = this.options.renderer || new Renderer;
974
+ this.options.renderer = this.options.renderer || new Renderer();
974
975
  this.renderer = this.options.renderer;
975
976
  this.renderer.options = this.options;
976
977
  }
@@ -991,7 +992,10 @@ Parser.parse = function(src, options) {
991
992
  Parser.prototype.parse = function(src) {
992
993
  this.inline = new InlineLexer(src.links, this.options);
993
994
  // use an InlineLexer with a TextRenderer to extract pure text
994
- this.inlineText = new InlineLexer(src.links, merge({}, this.options, {renderer: new TextRenderer}));
995
+ this.inlineText = new InlineLexer(
996
+ src.links,
997
+ merge({}, this.options, {renderer: new TextRenderer()})
998
+ );
995
999
  this.tokens = src.reverse();
996
1000
 
997
1001
  var out = '';
@@ -1056,12 +1060,12 @@ Parser.prototype.tok = function() {
1056
1060
  this.token.escaped);
1057
1061
  }
1058
1062
  case 'table': {
1059
- var header = ''
1060
- , body = ''
1061
- , i
1062
- , row
1063
- , cell
1064
- , j;
1063
+ var header = '',
1064
+ body = '',
1065
+ i,
1066
+ row,
1067
+ cell,
1068
+ j;
1065
1069
 
1066
1070
  // header
1067
1071
  cell = '';
@@ -1089,7 +1093,7 @@ Parser.prototype.tok = function() {
1089
1093
  return this.renderer.table(header, body);
1090
1094
  }
1091
1095
  case 'blockquote_start': {
1092
- var body = '';
1096
+ body = '';
1093
1097
 
1094
1098
  while (this.next().type !== 'blockquote_end') {
1095
1099
  body += this.tok();
@@ -1098,17 +1102,18 @@ Parser.prototype.tok = function() {
1098
1102
  return this.renderer.blockquote(body);
1099
1103
  }
1100
1104
  case 'list_start': {
1101
- var body = ''
1102
- , ordered = this.token.ordered;
1105
+ body = '';
1106
+ var ordered = this.token.ordered,
1107
+ start = this.token.start;
1103
1108
 
1104
1109
  while (this.next().type !== 'list_end') {
1105
1110
  body += this.tok();
1106
1111
  }
1107
1112
 
1108
- return this.renderer.list(body, ordered);
1113
+ return this.renderer.list(body, ordered, start);
1109
1114
  }
1110
1115
  case 'list_item_start': {
1111
- var body = '';
1116
+ body = '';
1112
1117
 
1113
1118
  while (this.next().type !== 'list_item_end') {
1114
1119
  body += this.token.type === 'text'
@@ -1119,7 +1124,7 @@ Parser.prototype.tok = function() {
1119
1124
  return this.renderer.listitem(body);
1120
1125
  }
1121
1126
  case 'loose_item_start': {
1122
- var body = '';
1127
+ body = '';
1123
1128
 
1124
1129
  while (this.next().type !== 'list_item_end') {
1125
1130
  body += this.tok();
@@ -1156,7 +1161,7 @@ function escape(html, encode) {
1156
1161
  }
1157
1162
 
1158
1163
  function unescape(html) {
1159
- // explicitly match decimal, hex, and named HTML entities
1164
+ // explicitly match decimal, hex, and named HTML entities
1160
1165
  return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, function(_, n) {
1161
1166
  n = n.toLowerCase();
1162
1167
  if (n === 'colon') return ':';
@@ -1169,15 +1174,19 @@ function unescape(html) {
1169
1174
  });
1170
1175
  }
1171
1176
 
1172
- function replace(regex, opt) {
1177
+ function edit(regex, opt) {
1173
1178
  regex = regex.source;
1174
1179
  opt = opt || '';
1175
- return function self(name, val) {
1176
- if (!name) return new RegExp(regex, opt);
1177
- val = val.source || val;
1178
- val = val.replace(/(^|[^\[])\^/g, '$1');
1179
- regex = regex.replace(name, val);
1180
- return self;
1180
+ return {
1181
+ replace: function(name, val) {
1182
+ val = val.source || val;
1183
+ val = val.replace(/(^|[^\[])\^/g, '$1');
1184
+ regex = regex.replace(name, val);
1185
+ return this;
1186
+ },
1187
+ getRegex: function() {
1188
+ return new RegExp(regex, opt);
1189
+ }
1181
1190
  };
1182
1191
  }
1183
1192
 
@@ -1209,9 +1218,9 @@ function noop() {}
1209
1218
  noop.exec = noop;
1210
1219
 
1211
1220
  function merge(obj) {
1212
- var i = 1
1213
- , target
1214
- , key;
1221
+ var i = 1,
1222
+ target,
1223
+ key;
1215
1224
 
1216
1225
  for (; i < arguments.length; i++) {
1217
1226
  target = arguments[i];
@@ -1225,19 +1234,19 @@ function merge(obj) {
1225
1234
  return obj;
1226
1235
  }
1227
1236
 
1228
-
1229
1237
  /**
1230
1238
  * Marked
1231
1239
  */
1232
1240
 
1233
1241
  function marked(src, opt, callback) {
1234
1242
  // throw error in case of non string input
1235
- if (typeof src == 'undefined' || src === null)
1243
+ if (typeof src === 'undefined' || src === null) {
1236
1244
  throw new Error('marked(): input parameter is undefined or null');
1237
- if (typeof src != 'string')
1238
- throw new Error('marked(): input parameter is of type ' +
1239
- Object.prototype.toString.call(src) + ', string expected');
1240
-
1245
+ }
1246
+ if (typeof src !== 'string') {
1247
+ throw new Error('marked(): input parameter is of type '
1248
+ + Object.prototype.toString.call(src) + ', string expected');
1249
+ }
1241
1250
 
1242
1251
  if (callback || typeof opt === 'function') {
1243
1252
  if (!callback) {
@@ -1247,10 +1256,10 @@ function marked(src, opt, callback) {
1247
1256
 
1248
1257
  opt = merge({}, marked.defaults, opt || {});
1249
1258
 
1250
- var highlight = opt.highlight
1251
- , tokens
1252
- , pending
1253
- , i = 0;
1259
+ var highlight = opt.highlight,
1260
+ tokens,
1261
+ pending,
1262
+ i = 0;
1254
1263
 
1255
1264
  try {
1256
1265
  tokens = Lexer.lex(src, opt)
@@ -1312,7 +1321,7 @@ function marked(src, opt, callback) {
1312
1321
  if (opt) opt = merge({}, marked.defaults, opt);
1313
1322
  return Parser.parse(Lexer.lex(src, opt), opt);
1314
1323
  } catch (e) {
1315
- e.message += '\nPlease report this to https://github.com/chjj/marked.';
1324
+ e.message += '\nPlease report this to https://github.com/markedjs/marked.';
1316
1325
  if ((opt || marked.defaults).silent) {
1317
1326
  return '<p>An error occurred:</p><pre>'
1318
1327
  + escape(e.message + '', true)
@@ -1346,7 +1355,7 @@ marked.defaults = {
1346
1355
  langPrefix: 'lang-',
1347
1356
  smartypants: false,
1348
1357
  headerPrefix: '',
1349
- renderer: new Renderer,
1358
+ renderer: new Renderer(),
1350
1359
  xhtml: false,
1351
1360
  baseUrl: null
1352
1361
  };
@@ -1374,9 +1383,6 @@ if (typeof module !== 'undefined' && typeof exports === 'object') {
1374
1383
  } else if (typeof define === 'function' && define.amd) {
1375
1384
  define(function() { return marked; });
1376
1385
  } else {
1377
- this.marked = marked;
1386
+ root.marked = marked;
1378
1387
  }
1379
-
1380
- }).call(function() {
1381
- return this || (typeof window !== 'undefined' ? window : global);
1382
- }());
1388
+ })(this || (typeof window !== 'undefined' ? window : global));
package/man/marked.1 CHANGED
@@ -81,7 +81,7 @@ For configuring and running programmatically.
81
81
  require('marked')('*foo*', { gfm: true });
82
82
 
83
83
  .SH BUGS
84
- Please report any bugs to https://github.com/chjj/marked.
84
+ Please report any bugs to https://github.com/markedjs/marked.
85
85
 
86
86
  .SH LICENSE
87
87
  Copyright (c) 2011-2014, Christopher Jeffrey (MIT License).
package/marked.min.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * marked - a markdown parser
3
3
  * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
4
- * https://github.com/chjj/marked
4
+ * https://github.com/markedjs/marked
5
5
  */
6
- (function(){"use strict";var e={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:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,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]+)+)/,text:/^[^\n]+/};function t(t){this.tokens=[],this.tokens.links={},this.options=t||d.defaults,this.rules=e.normal,this.options.gfm&&(this.options.tables?this.rules=e.tables:this.rules=e.gfm)}e._label=/(?:\\[\[\]]|[^\[\]])+/,e._title=/(?:"(?:\\"|[^"]|"[^"\n]*")*"|'\n?(?:[^'\n]+\n?)*'|\([^()]*\))/,e.def=a(e.def)("label",e._label)("title",e._title)(),e.bullet=/(?:[*+-]|\d+\.)/,e.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,e.item=a(e.item,"gm")(/bull/g,e.bullet)(),e.list=a(e.list)(/bull/g,e.bullet)("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))")("def","\\n+(?="+e.def.source+")")(),e._tag="(?!(?: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",e.html=a(e.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|\s[^'"\/>]*)*?\/?>/)(/tag/g,e._tag)(),e.paragraph=a(e.paragraph)("hr",e.hr)("heading",e.heading)("lheading",e.lheading)("tag","<"+e._tag)(),e.blockquote=a(e.blockquote)("paragraph",e.paragraph)(),e.normal=f({},e),e.gfm=f({},e.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),e.gfm.paragraph=a(e.paragraph)("(?!","(?!"+e.gfm.fences.source.replace("\\1","\\2")+"|"+e.list.source.replace("\\1","\\3")+"|")(),e.tables=f({},e.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),t.rules=e,t.lex=function(e,n){return new t(n).lex(e)},t.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)},t.prototype.token=function(t,n){var r,s,i,l,o,h,a,p,u,c;for(t=t.replace(/^ +$/gm,"");t;)if((i=this.rules.newline.exec(t))&&(t=t.substring(i[0].length),i[0].length>1&&this.tokens.push({type:"space"})),i=this.rules.code.exec(t))t=t.substring(i[0].length),i=i[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?i:i.replace(/\n+$/,"")});else if(i=this.rules.fences.exec(t))t=t.substring(i[0].length),this.tokens.push({type:"code",lang:i[2],text:i[3]||""});else if(i=this.rules.heading.exec(t))t=t.substring(i[0].length),this.tokens.push({type:"heading",depth:i[1].length,text:i[2]});else if(n&&(i=this.rules.nptable.exec(t))){for(t=t.substring(i[0].length),h={type:"table",header:i[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3].replace(/\n$/,"").split("\n")},p=0;p<h.align.length;p++)/^ *-+: *$/.test(h.align[p])?h.align[p]="right":/^ *:-+: *$/.test(h.align[p])?h.align[p]="center":/^ *:-+ *$/.test(h.align[p])?h.align[p]="left":h.align[p]=null;for(p=0;p<h.cells.length;p++)h.cells[p]=h.cells[p].split(/ *\| */);this.tokens.push(h)}else if(i=this.rules.hr.exec(t))t=t.substring(i[0].length),this.tokens.push({type:"hr"});else if(i=this.rules.blockquote.exec(t))t=t.substring(i[0].length),this.tokens.push({type:"blockquote_start"}),i=i[0].replace(/^ *> ?/gm,""),this.token(i,n),this.tokens.push({type:"blockquote_end"});else if(i=this.rules.list.exec(t)){for(t=t.substring(i[0].length),l=i[2],this.tokens.push({type:"list_start",ordered:l.length>1}),r=!1,c=(i=i[0].match(this.rules.item)).length,p=0;p<c;p++)a=(h=i[p]).length,~(h=h.replace(/^ *([*+-]|\d+\.) +/,"")).indexOf("\n ")&&(a-=h.length,h=this.options.pedantic?h.replace(/^ {1,4}/gm,""):h.replace(new RegExp("^ {1,"+a+"}","gm"),"")),this.options.smartLists&&p!==c-1&&(l===(o=e.bullet.exec(i[p+1])[0])||l.length>1&&o.length>1||(t=i.slice(p+1).join("\n")+t,p=c-1)),s=r||/\n\n(?!\s*$)/.test(h),p!==c-1&&(r="\n"===h.charAt(h.length-1),s||(s=r)),this.tokens.push({type:s?"loose_item_start":"list_item_start"}),this.token(h,!1),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(i=this.rules.html.exec(t))t=t.substring(i[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===i[1]||"script"===i[1]||"style"===i[1]),text:i[0]});else if(n&&(i=this.rules.def.exec(t)))t=t.substring(i[0].length),i[3]&&(i[3]=i[3].substring(1,i[3].length-1)),u=i[1].toLowerCase(),this.tokens.links[u]||(this.tokens.links[u]={href:i[2],title:i[3]});else if(n&&(i=this.rules.table.exec(t))){for(t=t.substring(i[0].length),h={type:"table",header:i[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3].replace(/(?: *\| *)?\n$/,"").split("\n")},p=0;p<h.align.length;p++)/^ *-+: *$/.test(h.align[p])?h.align[p]="right":/^ *:-+: *$/.test(h.align[p])?h.align[p]="center":/^ *:-+ *$/.test(h.align[p])?h.align[p]="left":h.align[p]=null;for(p=0;p<h.cells.length;p++)h.cells[p]=h.cells[p].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(h)}else if(i=this.rules.lheading.exec(t))t=t.substring(i[0].length),this.tokens.push({type:"heading",depth:"="===i[2]?1:2,text:i[1]});else if(n&&(i=this.rules.paragraph.exec(t)))t=t.substring(i[0].length),this.tokens.push({type:"paragraph",text:"\n"===i[1].charAt(i[1].length-1)?i[1].slice(0,-1):i[1]});else if(i=this.rules.text.exec(t))t=t.substring(i[0].length),this.tokens.push({type:"text",text:i[0]});else if(t)throw new Error("Infinite loop on byte: "+t.charCodeAt(0));return this.tokens};var n={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:g,tag:/^<!--[\s\S]*?-->|^<\/?[a-zA-Z0-9\-]+(?:"[^"]*"|'[^']*'|\s[^<'">\/]*)*?\/?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|\\[\[\]]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^_([^\s_](?:[^_]|__)+?[^\s_])_\b|^\*((?:\*\*|[^*])+?)\*(?!\*)/,code:/^(`+)(\s*)([\s\S]*?[^`]?)\2\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:g,text:/^[\s\S]+?(?=[\\<!\[`*]|\b_| {2,}\n|$)/};function r(e,t){if(this.options=t||d.defaults,this.links=e,this.rules=n.normal,this.renderer=this.options.renderer||new s,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=n.breaks:this.rules=n.gfm:this.options.pedantic&&(this.rules=n.pedantic)}function s(e){this.options=e||{}}function i(){}function l(e){this.tokens=[],this.token=null,this.options=e||d.defaults,this.options.renderer=this.options.renderer||new s,this.renderer=this.options.renderer,this.renderer.options=this.options}function o(e,t){return e.replace(t?/&/g:/&(?!#?\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function h(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 a(e,t){return e=e.source,t=t||"",function n(r,s){return r?(s=(s=s.source||s).replace(/(^|[^\[])\^/g,"$1"),e=e.replace(r,s),n):new RegExp(e,t)}}function p(e,t){return u[" "+e]||(/^[^:]+:\/*[^/]*$/.test(e)?u[" "+e]=e+"/":u[" "+e]=e.replace(/[^/]*$/,"")),e=u[" "+e],"//"===t.slice(0,2)?e.replace(/:[\s\S]*/,":")+t:"/"===t.charAt(0)?e.replace(/(:\/*[^/]*)[\s\S]*/,"$1")+t:e+t}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=a(n.autolink)("scheme",n._scheme)("email",n._email)(),n._inside=/(?:\[[^\]]*\]|\\[\[\]]|[^\[\]]|\](?=[^\[]*\]))*/,n._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,n.link=a(n.link)("inside",n._inside)("href",n._href)(),n.reflink=a(n.reflink)("inside",n._inside)(),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)\*(?!\*)/}),n.gfm=f({},n.normal,{escape:a(n.escape)("])","~|])")(),url:a(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/)("email",n._email)(),_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:a(n.text)("]|","~]|")("|","|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&'*+/=?^_`{\\|}~-]+@|")()}),n.breaks=f({},n.gfm,{br:a(n.br)("{2,}","*")(),text:a(n.gfm.text)("{2,}","*")()}),r.rules=n,r.output=function(e,t,n){return new r(t,n).output(e)},r.prototype.output=function(e){for(var t,n,r,s,i="";e;)if(s=this.rules.escape.exec(e))e=e.substring(s[0].length),i+=s[1];else if(s=this.rules.autolink.exec(e))e=e.substring(s[0].length),r="@"===s[2]?"mailto:"+(n=o(this.mangle(s[1]))):n=o(s[1]),i+=this.renderer.link(r,null,n);else if(this.inLink||!(s=this.rules.url.exec(e))){if(s=this.rules.tag.exec(e))!this.inLink&&/^<a /i.test(s[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(s[0])&&(this.inLink=!1),e=e.substring(s[0].length),i+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(s[0]):o(s[0]):s[0];else if(s=this.rules.link.exec(e))e=e.substring(s[0].length),this.inLink=!0,i+=this.outputLink(s,{href:s[2],title:s[3]}),this.inLink=!1;else if((s=this.rules.reflink.exec(e))||(s=this.rules.nolink.exec(e))){if(e=e.substring(s[0].length),t=(s[2]||s[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){i+=s[0].charAt(0),e=s[0].substring(1)+e;continue}this.inLink=!0,i+=this.outputLink(s,t),this.inLink=!1}else if(s=this.rules.strong.exec(e))e=e.substring(s[0].length),i+=this.renderer.strong(this.output(s[2]||s[1]));else if(s=this.rules.em.exec(e))e=e.substring(s[0].length),i+=this.renderer.em(this.output(s[2]||s[1]));else if(s=this.rules.code.exec(e))e=e.substring(s[0].length),i+=this.renderer.codespan(o(s[3].trim(),!0));else if(s=this.rules.br.exec(e))e=e.substring(s[0].length),i+=this.renderer.br();else if(s=this.rules.del.exec(e))e=e.substring(s[0].length),i+=this.renderer.del(this.output(s[1]));else if(s=this.rules.text.exec(e))e=e.substring(s[0].length),i+=this.renderer.text(o(this.smartypants(s[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else s[0]=this.rules._backpedal.exec(s[0])[0],e=e.substring(s[0].length),"@"===s[2]?r="mailto:"+(n=o(s[0])):(n=o(s[0]),r="www."===s[1]?"http://"+n:n),i+=this.renderer.link(r,null,n);return i},r.prototype.outputLink=function(e,t){var n=o(t.href),r=t.title?o(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,o(e[1]))},r.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},r.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),Math.random()>.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},s.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+o(t,!0)+'">'+(n?e:o(e,!0))+"\n</code></pre>\n":"<pre><code>"+(n?e:o(e,!0))+"\n</code></pre>"},s.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},s.prototype.html=function(e){return e},s.prototype.heading=function(e,t,n){return"<h"+t+' id="'+this.options.headerPrefix+n.toLowerCase().replace(/[^\w]+/g,"-")+'">'+e+"</h"+t+">\n"},s.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},s.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+"</"+n+">\n"},s.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},s.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},s.prototype.table=function(e,t){return"<table>\n<thead>\n"+e+"</thead>\n<tbody>\n"+t+"</tbody>\n</table>\n"},s.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},s.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">")+e+"</"+n+">\n"},s.prototype.strong=function(e){return"<strong>"+e+"</strong>"},s.prototype.em=function(e){return"<em>"+e+"</em>"},s.prototype.codespan=function(e){return"<code>"+e+"</code>"},s.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},s.prototype.del=function(e){return"<del>"+e+"</del>"},s.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(h(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&&!c.test(e)&&(e=p(this.options.baseUrl,e));var s='<a href="'+e+'"';return t&&(s+=' title="'+t+'"'),s+=">"+n+"</a>"},s.prototype.image=function(e,t,n){this.options.baseUrl&&!c.test(e)&&(e=p(this.options.baseUrl,e));var r='<img src="'+e+'" alt="'+n+'"';return t&&(r+=' title="'+t+'"'),r+=this.options.xhtml?"/>":">"},s.prototype.text=function(e){return e},i.prototype.strong=i.prototype.em=i.prototype.codespan=i.prototype.del=i.prototype.text=function(e){return e},i.prototype.link=i.prototype.image=function(e,t,n){return""+n},i.prototype.br=function(){return""},l.parse=function(e,t){return new l(t).parse(e)},l.prototype.parse=function(e){this.inline=new r(e.links,this.options),this.inlineText=new r(e.links,f({},this.options,{renderer:new i})),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},l.prototype.next=function(){return this.token=this.tokens.pop()},l.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},l.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},l.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,h(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;"list_end"!==this.next().type;)i+=this.tok();return this.renderer.list(i,l);case"list_item_start":for(i="";"list_item_end"!==this.next().type;)i+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(i);case"loose_item_start":for(i="";"list_item_end"!==this.next().type;)i+=this.tok();return this.renderer.listitem(i);case"html":var o=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);return this.renderer.html(o);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}};var u={},c=/^$|^[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 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,h=(n=f({},d.defaults,n||{})).highlight,a=0;try{s=t.lex(e,n)}catch(e){return r(e)}i=s.length;var p=function(e){if(e)return n.highlight=h,r(e);var t;try{t=l.parse(s,n)}catch(t){e=t}return n.highlight=h,e?r(e):r(null,t)};if(!h||h.length<3)return p();if(delete n.highlight,!i)return p();for(;a<s.length;a++)!function(e){"code"!==e.type?--i||p():h(e.text,e.lang,function(t,n){return t?p(t):null==n||n===e.text?--i||p():(e.text=n,e.escaped=!0,void(--i||p()))})}(s[a])}else try{return n&&(n=f({},d.defaults,n)),l.parse(t.lex(e,n),n)}catch(e){if(e.message+="\nPlease report this to https://github.com/chjj/marked.",(n||d.defaults).silent)return"<p>An error occurred:</p><pre>"+o(e.message+"",!0)+"</pre>";throw e}}g.exec=g,d.options=d.setOptions=function(e){return f(d.defaults,e),d},d.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new s,xhtml:!1,baseUrl:null},d.Parser=l,d.parser=l.parse,d.Renderer=s,d.TextRenderer=i,d.Lexer=t,d.lexer=t.lex,d.InlineLexer=r,d.inlineLexer=r.output,d.parse=d,"undefined"!=typeof module&&"object"==typeof exports?module.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):this.marked=d}).call(function(){return this||("undefined"!=typeof window?window:global)}());
6
+ !function(e){"use strict";var t={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:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,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]+)+)/,text:/^[^\n]+/};function n(e){this.tokens=[],this.tokens.links={},this.options=e||k.defaults,this.rules=t.normal,this.options.gfm&&(this.options.tables?this.rules=t.tables:this.rules=t.gfm)}t._label=/(?:\\[\[\]]|[^\[\]])+/,t._title=/(?:"(?:\\"|[^"]|"[^"\n]*")*"|'\n?(?:[^'\n]+\n?)*'|\([^()]*\))/,t.def=p(t.def).replace("label",t._label).replace("title",t._title).getRegex(),t.bullet=/(?:[*+-]|\d+\.)/,t.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,t.item=p(t.item,"gm").replace(/bull/g,t.bullet).getRegex(),t.list=p(t.list).replace(/bull/g,t.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+t.def.source+")").getRegex(),t._tag="(?!(?: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",t.html=p(t.html).replace("comment",/<!--[\s\S]*?-->/).replace("closed",/<(tag)[\s\S]+?<\/\1>/).replace("closing",/<tag(?:"[^"]*"|'[^']*'|\s[^'"\/>\s]*)*?\/?>/).replace(/tag/g,t._tag).getRegex(),t.paragraph=p(t.paragraph).replace("hr",t.hr).replace("heading",t.heading).replace("lheading",t.lheading).replace("tag","<"+t._tag).getRegex(),t.blockquote=p(t.blockquote).replace("paragraph",t.paragraph).getRegex(),t.normal=d({},t),t.gfm=d({},t.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),t.gfm.paragraph=p(t.paragraph).replace("(?!","(?!"+t.gfm.fences.source.replace("\\1","\\2")+"|"+t.list.source.replace("\\1","\\3")+"|").getRegex(),t.tables=d({},t.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),n.rules=t,n.lex=function(e,t){return new n(t).lex(e)},n.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)},n.prototype.token=function(e,n){var r,s,i,l,o,a,h,p,u,c,g;for(e=e.replace(/^ +$/gm,"");e;)if((i=this.rules.newline.exec(e))&&(e=e.substring(i[0].length),i[0].length>1&&this.tokens.push({type:"space"})),i=this.rules.code.exec(e))e=e.substring(i[0].length),i=i[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?i:i.replace(/\n+$/,"")});else if(i=this.rules.fences.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"code",lang:i[2],text:i[3]||""});else if(i=this.rules.heading.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"heading",depth:i[1].length,text:i[2]});else if(n&&(i=this.rules.nptable.exec(e))){for(e=e.substring(i[0].length),a={type:"table",header:i[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3].replace(/\n$/,"").split("\n")},p=0;p<a.align.length;p++)/^ *-+: *$/.test(a.align[p])?a.align[p]="right":/^ *:-+: *$/.test(a.align[p])?a.align[p]="center":/^ *:-+ *$/.test(a.align[p])?a.align[p]="left":a.align[p]=null;for(p=0;p<a.cells.length;p++)a.cells[p]=a.cells[p].split(/ *\| */);this.tokens.push(a)}else if(i=this.rules.hr.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"hr"});else if(i=this.rules.blockquote.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"blockquote_start"}),i=i[0].replace(/^ *> ?/gm,""),this.token(i,n),this.tokens.push({type:"blockquote_end"});else if(i=this.rules.list.exec(e)){for(e=e.substring(i[0].length),g=(l=i[2]).length>1,this.tokens.push({type:"list_start",ordered:g,start:g?+l:""}),r=!1,c=(i=i[0].match(this.rules.item)).length,p=0;p<c;p++)h=(a=i[p]).length,~(a=a.replace(/^ *([*+-]|\d+\.) +/,"")).indexOf("\n ")&&(h-=a.length,a=this.options.pedantic?a.replace(/^ {1,4}/gm,""):a.replace(new RegExp("^ {1,"+h+"}","gm"),"")),this.options.smartLists&&p!==c-1&&(l===(o=t.bullet.exec(i[p+1])[0])||l.length>1&&o.length>1||(e=i.slice(p+1).join("\n")+e,p=c-1)),s=r||/\n\n(?!\s*$)/.test(a),p!==c-1&&(r="\n"===a.charAt(a.length-1),s||(s=r)),this.tokens.push({type:s?"loose_item_start":"list_item_start"}),this.token(a,!1),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(i=this.rules.html.exec(e))e=e.substring(i[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===i[1]||"script"===i[1]||"style"===i[1]),text:i[0]});else if(n&&(i=this.rules.def.exec(e)))e=e.substring(i[0].length),i[3]&&(i[3]=i[3].substring(1,i[3].length-1)),u=i[1].toLowerCase(),this.tokens.links[u]||(this.tokens.links[u]={href:i[2],title:i[3]});else if(n&&(i=this.rules.table.exec(e))){for(e=e.substring(i[0].length),a={type:"table",header:i[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3].replace(/(?: *\| *)?\n$/,"").split("\n")},p=0;p<a.align.length;p++)/^ *-+: *$/.test(a.align[p])?a.align[p]="right":/^ *:-+: *$/.test(a.align[p])?a.align[p]="center":/^ *:-+ *$/.test(a.align[p])?a.align[p]="left":a.align[p]=null;for(p=0;p<a.cells.length;p++)a.cells[p]=a.cells[p].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(a)}else if(i=this.rules.lheading.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"heading",depth:"="===i[2]?1:2,text:i[1]});else if(n&&(i=this.rules.paragraph.exec(e)))e=e.substring(i[0].length),this.tokens.push({type:"paragraph",text:"\n"===i[1].charAt(i[1].length-1)?i[1].slice(0,-1):i[1]});else if(i=this.rules.text.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"text",text:i[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens};var r={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:f,tag:/^<!--[\s\S]*?-->|^<\/?[a-zA-Z0-9\-]+(?:"[^"]*"|'[^']*'|\s[^<'">\/\s]*)*?\/?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^_([^\s_](?:[^_]|__)+?[^\s_])_\b|^\*((?:\*\*|[^*])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`]?)\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:f,text:/^[\s\S]+?(?=[\\<!\[`*]|\b_| {2,}\n|$)/};function s(e,t){if(this.options=t||k.defaults,this.links=e,this.rules=r.normal,this.renderer=this.options.renderer||new i,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=r.breaks:this.rules=r.gfm:this.options.pedantic&&(this.rules=r.pedantic)}function i(e){this.options=e||{}}function l(){}function o(e){this.tokens=[],this.token=null,this.options=e||k.defaults,this.options.renderer=this.options.renderer||new i,this.renderer=this.options.renderer,this.renderer.options=this.options}function a(e,t){return e.replace(t?/&/g:/&(?!#?\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function h(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 p(e,t){return e=e.source,t=t||"",{replace:function(t,n){return n=(n=n.source||n).replace(/(^|[^\[])\^/g,"$1"),e=e.replace(t,n),this},getRegex:function(){return new RegExp(e,t)}}}function u(e,t){return c[" "+e]||(/^[^:]+:\/*[^/]*$/.test(e)?c[" "+e]=e+"/":c[" "+e]=e.replace(/[^/]*$/,"")),e=c[" "+e],"//"===t.slice(0,2)?e.replace(/:[\s\S]*/,":")+t:"/"===t.charAt(0)?e.replace(/(:\/*[^/]*)[\s\S]*/,"$1")+t:e+t}r._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,r._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])?)+(?![-_])/,r.autolink=p(r.autolink).replace("scheme",r._scheme).replace("email",r._email).getRegex(),r._inside=/(?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]]|\](?=[^\[]*\]))*/,r._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,r.link=p(r.link).replace("inside",r._inside).replace("href",r._href).getRegex(),r.reflink=p(r.reflink).replace("inside",r._inside).getRegex(),r.normal=d({},r),r.pedantic=d({},r.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),r.gfm=d({},r.normal,{escape:p(r.escape).replace("])","~|])").getRegex(),url:p(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("email",r._email).getRegex(),_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:p(r.text).replace("]|","~]|").replace("|","|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&'*+/=?^_`{\\|}~-]+@|").getRegex()}),r.breaks=d({},r.gfm,{br:p(r.br).replace("{2,}","*").getRegex(),text:p(r.gfm.text).replace("{2,}","*").getRegex()}),s.rules=r,s.output=function(e,t,n){return new s(t,n).output(e)},s.prototype.output=function(e){for(var t,n,r,s,i="";e;)if(s=this.rules.escape.exec(e))e=e.substring(s[0].length),i+=s[1];else if(s=this.rules.autolink.exec(e))e=e.substring(s[0].length),r="@"===s[2]?"mailto:"+(n=a(this.mangle(s[1]))):n=a(s[1]),i+=this.renderer.link(r,null,n);else if(this.inLink||!(s=this.rules.url.exec(e))){if(s=this.rules.tag.exec(e))!this.inLink&&/^<a /i.test(s[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(s[0])&&(this.inLink=!1),e=e.substring(s[0].length),i+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(s[0]):a(s[0]):s[0];else if(s=this.rules.link.exec(e))e=e.substring(s[0].length),this.inLink=!0,i+=this.outputLink(s,{href:s[2],title:s[3]}),this.inLink=!1;else if((s=this.rules.reflink.exec(e))||(s=this.rules.nolink.exec(e))){if(e=e.substring(s[0].length),t=(s[2]||s[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){i+=s[0].charAt(0),e=s[0].substring(1)+e;continue}this.inLink=!0,i+=this.outputLink(s,t),this.inLink=!1}else if(s=this.rules.strong.exec(e))e=e.substring(s[0].length),i+=this.renderer.strong(this.output(s[2]||s[1]));else if(s=this.rules.em.exec(e))e=e.substring(s[0].length),i+=this.renderer.em(this.output(s[2]||s[1]));else if(s=this.rules.code.exec(e))e=e.substring(s[0].length),i+=this.renderer.codespan(a(s[2].trim(),!0));else if(s=this.rules.br.exec(e))e=e.substring(s[0].length),i+=this.renderer.br();else if(s=this.rules.del.exec(e))e=e.substring(s[0].length),i+=this.renderer.del(this.output(s[1]));else if(s=this.rules.text.exec(e))e=e.substring(s[0].length),i+=this.renderer.text(a(this.smartypants(s[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else s[0]=this.rules._backpedal.exec(s[0])[0],e=e.substring(s[0].length),"@"===s[2]?r="mailto:"+(n=a(s[0])):(n=a(s[0]),r="www."===s[1]?"http://"+n:n),i+=this.renderer.link(r,null,n);return i},s.prototype.outputLink=function(e,t){var n=a(t.href),r=t.title?a(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,a(e[1]))},s.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},s.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),Math.random()>.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},i.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+a(t,!0)+'">'+(n?e:a(e,!0))+"\n</code></pre>\n":"<pre><code>"+(n?e:a(e,!0))+"\n</code></pre>"},i.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},i.prototype.html=function(e){return e},i.prototype.heading=function(e,t,n){return"<h"+t+' id="'+this.options.headerPrefix+n.toLowerCase().replace(/[^\w]+/g,"-")+'">'+e+"</h"+t+">\n"},i.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},i.prototype.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+r+">\n"},i.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},i.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},i.prototype.table=function(e,t){return"<table>\n<thead>\n"+e+"</thead>\n<tbody>\n"+t+"</tbody>\n</table>\n"},i.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},i.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">")+e+"</"+n+">\n"},i.prototype.strong=function(e){return"<strong>"+e+"</strong>"},i.prototype.em=function(e){return"<em>"+e+"</em>"},i.prototype.codespan=function(e){return"<code>"+e+"</code>"},i.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},i.prototype.del=function(e){return"<del>"+e+"</del>"},i.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(h(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&&!g.test(e)&&(e=u(this.options.baseUrl,e));var s='<a href="'+e+'"';return t&&(s+=' title="'+t+'"'),s+=">"+n+"</a>"},i.prototype.image=function(e,t,n){this.options.baseUrl&&!g.test(e)&&(e=u(this.options.baseUrl,e));var r='<img src="'+e+'" alt="'+n+'"';return t&&(r+=' title="'+t+'"'),r+=this.options.xhtml?"/>":">"},i.prototype.text=function(e){return e},l.prototype.strong=l.prototype.em=l.prototype.codespan=l.prototype.del=l.prototype.text=function(e){return e},l.prototype.link=l.prototype.image=function(e,t,n){return""+n},l.prototype.br=function(){return""},o.parse=function(e,t){return new o(t).parse(e)},o.prototype.parse=function(e){this.inline=new s(e.links,this.options),this.inlineText=new s(e.links,d({},this.options,{renderer:new l})),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},o.prototype.next=function(){return this.token=this.tokens.pop()},o.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},o.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},o.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,h(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":for(i="";"list_item_end"!==this.next().type;)i+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(i);case"loose_item_start":for(i="";"list_item_end"!==this.next().type;)i+=this.tok();return this.renderer.listitem(i);case"html":var a=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);return this.renderer.html(a);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}};var c={},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 k(e,t,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 t){r||(r=t,t=null);var s,i,l=(t=d({},k.defaults,t||{})).highlight,h=0;try{s=n.lex(e,t)}catch(e){return r(e)}i=s.length;var p=function(e){if(e)return t.highlight=l,r(e);var n;try{n=o.parse(s,t)}catch(t){e=t}return t.highlight=l,e?r(e):r(null,n)};if(!l||l.length<3)return p();if(delete t.highlight,!i)return p();for(;h<s.length;h++)!function(e){"code"!==e.type?--i||p():l(e.text,e.lang,function(t,n){return t?p(t):null==n||n===e.text?--i||p():(e.text=n,e.escaped=!0,void(--i||p()))})}(s[h])}else try{return t&&(t=d({},k.defaults,t)),o.parse(n.lex(e,t),t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",(t||k.defaults).silent)return"<p>An error occurred:</p><pre>"+a(e.message+"",!0)+"</pre>";throw e}}f.exec=f,k.options=k.setOptions=function(e){return d(k.defaults,e),k},k.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new i,xhtml:!1,baseUrl:null},k.Parser=o,k.parser=o.parse,k.Renderer=i,k.TextRenderer=l,k.Lexer=n,k.lexer=n.lex,k.InlineLexer=s,k.inlineLexer=s.output,k.parse=k,"undefined"!=typeof module&&"object"==typeof exports?module.exports=k:"function"==typeof define&&define.amd?define(function(){return k}):e.marked=k}(this||("undefined"!=typeof window?window:global));