2 * marked - a markdown parser
3 * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
4 * https://github.com/chjj/marked
15 code: /^( {4}[^\n]+\n*)+/,
17 hr: /^( *[-*_]){3,} *(?:\n+|$)/,
18 heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,
20 lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
21 blockquote: /^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,
22 list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
23 html: /^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,
24 def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,
26 paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,
30 block.bullet = /(?:[*+-]|\d+\.)/;
31 block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;
32 block.item = replace(block.item, 'gm')
33 (/bull/g, block.bullet)
36 block.list = replace(block.list)
37 (/bull/g, block.bullet)
38 ('hr', '\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))')
39 ('def', '\\n+(?=' + block.def.source + ')')
42 block.blockquote = replace(block.blockquote)
47 + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code'
48 + '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo'
49 + '|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b';
51 block.html = replace(block.html)
52 ('comment', /<!--[\s\S]*?-->/)
53 ('closed', /<(tag)[\s\S]+?<\/\1>/)
54 ('closing', /<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)
58 block.paragraph = replace(block.paragraph)
60 ('heading', block.heading)
61 ('lheading', block.lheading)
62 ('blockquote', block.blockquote)
63 ('tag', '<' + block._tag)
68 * Normal Block Grammar
71 block.normal = merge({}, block);
77 block.gfm = merge({}, block.normal, {
78 fences: /^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,
82 block.gfm.paragraph = replace(block.paragraph)
84 + block.gfm.fences.source.replace('\\1', '\\2') + '|'
85 + block.list.source.replace('\\1', '\\3') + '|')
89 * GFM + Tables Block Grammar
92 block.tables = merge({}, block.gfm, {
93 nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,
94 table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/
101 function Lexer(options) {
103 this.tokens.links = {};
104 this.options = options || marked.defaults;
105 this.rules = block.normal;
107 if (this.options.gfm) {
108 if (this.options.tables) {
109 this.rules = block.tables;
111 this.rules = block.gfm;
126 Lexer.lex = function(src, options) {
127 var lexer = new Lexer(options);
128 return lexer.lex(src);
135 Lexer.prototype.lex = function(src) {
137 .replace(/\r\n|\r/g, '\n')
139 .replace(/\u00a0/g, ' ')
140 .replace(/\u2424/g, '\n');
142 return this.token(src, true);
149 Lexer.prototype.token = function(src, top, bq) {
150 var src = src.replace(/^ +$/gm, '')
163 if (cap = this.rules.newline.exec(src)) {
164 src = src.substring(cap[0].length);
165 if (cap[0].length > 1) {
173 if (cap = this.rules.code.exec(src)) {
174 src = src.substring(cap[0].length);
175 cap = cap[0].replace(/^ {4}/gm, '');
178 text: !this.options.pedantic
179 ? cap.replace(/\n+$/, '')
186 if (cap = this.rules.fences.exec(src)) {
187 src = src.substring(cap[0].length);
197 if (cap = this.rules.heading.exec(src)) {
198 src = src.substring(cap[0].length);
201 depth: cap[1].length,
207 // table no leading pipe (gfm)
208 if (top && (cap = this.rules.nptable.exec(src))) {
209 src = src.substring(cap[0].length);
213 header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
214 align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
215 cells: cap[3].replace(/\n$/, '').split('\n')
218 for (i = 0; i < item.align.length; i++) {
219 if (/^ *-+: *$/.test(item.align[i])) {
220 item.align[i] = 'right';
221 } else if (/^ *:-+: *$/.test(item.align[i])) {
222 item.align[i] = 'center';
223 } else if (/^ *:-+ *$/.test(item.align[i])) {
224 item.align[i] = 'left';
226 item.align[i] = null;
230 for (i = 0; i < item.cells.length; i++) {
231 item.cells[i] = item.cells[i].split(/ *\| */);
234 this.tokens.push(item);
240 if (cap = this.rules.lheading.exec(src)) {
241 src = src.substring(cap[0].length);
244 depth: cap[2] === '=' ? 1 : 2,
251 if (cap = this.rules.hr.exec(src)) {
252 src = src.substring(cap[0].length);
260 if (cap = this.rules.blockquote.exec(src)) {
261 src = src.substring(cap[0].length);
264 type: 'blockquote_start'
267 cap = cap[0].replace(/^ *> ?/gm, '');
269 // Pass `top` to keep the current
270 // "toplevel" state. This is exactly
271 // how markdown.pl works.
272 this.token(cap, top, true);
275 type: 'blockquote_end'
282 if (cap = this.rules.list.exec(src)) {
283 src = src.substring(cap[0].length);
288 ordered: bull.length > 1
291 // Get each top-level item.
292 cap = cap[0].match(this.rules.item);
301 // Remove the list item's bullet
302 // so it is seen as the next token.
304 item = item.replace(/^ *([*+-]|\d+\.) +/, '');
306 // Outdent whatever the
307 // list item contains. Hacky.
308 if (~item.indexOf('\n ')) {
309 space -= item.length;
310 item = !this.options.pedantic
311 ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '')
312 : item.replace(/^ {1,4}/gm, '');
315 // Determine whether the next list item belongs here.
316 // Backpedal if it does not belong in this list.
317 if (this.options.smartLists && i !== l - 1) {
318 b = block.bullet.exec(cap[i + 1])[0];
319 if (bull !== b && !(bull.length > 1 && b.length > 1)) {
320 src = cap.slice(i + 1).join('\n') + src;
325 // Determine whether item is loose or not.
326 // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
327 // for discount behavior.
328 loose = next || /\n\n(?!\s*$)/.test(item);
330 next = item.charAt(item.length - 1) === '\n';
331 if (!loose) loose = next;
341 this.token(item, false, bq);
344 type: 'list_item_end'
356 if (cap = this.rules.html.exec(src)) {
357 src = src.substring(cap[0].length);
359 type: this.options.sanitize
362 pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',
369 if ((!bq && top) && (cap = this.rules.def.exec(src))) {
370 src = src.substring(cap[0].length);
371 this.tokens.links[cap[1].toLowerCase()] = {
379 if (top && (cap = this.rules.table.exec(src))) {
380 src = src.substring(cap[0].length);
384 header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
385 align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
386 cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n')
389 for (i = 0; i < item.align.length; i++) {
390 if (/^ *-+: *$/.test(item.align[i])) {
391 item.align[i] = 'right';
392 } else if (/^ *:-+: *$/.test(item.align[i])) {
393 item.align[i] = 'center';
394 } else if (/^ *:-+ *$/.test(item.align[i])) {
395 item.align[i] = 'left';
397 item.align[i] = null;
401 for (i = 0; i < item.cells.length; i++) {
402 item.cells[i] = item.cells[i]
403 .replace(/^ *\| *| *\| *$/g, '')
407 this.tokens.push(item);
412 // top-level paragraph
413 if (top && (cap = this.rules.paragraph.exec(src))) {
414 src = src.substring(cap[0].length);
417 text: cap[1].charAt(cap[1].length - 1) === '\n'
418 ? cap[1].slice(0, -1)
425 if (cap = this.rules.text.exec(src)) {
426 // Top-level should never reach here.
427 src = src.substring(cap[0].length);
437 Error('Infinite loop on byte: ' + src.charCodeAt(0));
445 * Inline-Level Grammar
449 escape: /^\\([\\`*{}\[\]()#+\-.!_>])/,
450 autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
452 tag: /^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,
453 link: /^!?\[(inside)\]\(href\)/,
454 reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/,
455 nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,
456 strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,
457 em: /^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
458 code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,
459 br: /^ {2,}\n(?!\s*$)/,
461 text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/
464 inline._inside = /(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/;
465 inline._href = /\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;
467 inline.link = replace(inline.link)
468 ('inside', inline._inside)
469 ('href', inline._href)
472 inline.reflink = replace(inline.reflink)
473 ('inside', inline._inside)
477 * Normal Inline Grammar
480 inline.normal = merge({}, inline);
483 * Pedantic Inline Grammar
486 inline.pedantic = merge({}, inline.normal, {
487 strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
488 em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/
495 inline.gfm = merge({}, inline.normal, {
496 escape: replace(inline.escape)('])', '~|])')(),
497 url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,
498 del: /^~~(?=\S)([\s\S]*?\S)~~/,
499 text: replace(inline.text)
506 * GFM + Line Breaks Inline Grammar
509 inline.breaks = merge({}, inline.gfm, {
510 br: replace(inline.br)('{2,}', '*')(),
511 text: replace(inline.gfm.text)('{2,}', '*')()
515 * Inline Lexer & Compiler
518 function InlineLexer(links, options) {
519 this.options = options || marked.defaults;
521 this.rules = inline.normal;
522 this.renderer = this.options.renderer || new Renderer;
523 this.renderer.options = this.options;
527 Error('Tokens array requires a `links` property.');
530 if (this.options.gfm) {
531 if (this.options.breaks) {
532 this.rules = inline.breaks;
534 this.rules = inline.gfm;
536 } else if (this.options.pedantic) {
537 this.rules = inline.pedantic;
542 * Expose Inline Rules
545 InlineLexer.rules = inline;
548 * Static Lexing/Compiling Method
551 InlineLexer.output = function(src, links, options) {
552 var inline = new InlineLexer(links, options);
553 return inline.output(src);
560 InlineLexer.prototype.output = function(src) {
569 if (cap = this.rules.escape.exec(src)) {
570 src = src.substring(cap[0].length);
576 if (cap = this.rules.autolink.exec(src)) {
577 src = src.substring(cap[0].length);
578 if (cap[2] === '@') {
579 text = cap[1].charAt(6) === ':'
580 ? this.mangle(cap[1].substring(7))
581 : this.mangle(cap[1]);
582 href = this.mangle('mailto:') + text;
584 text = escape(cap[1]);
587 out += this.renderer.link(href, null, text);
592 if (!this.inLink && (cap = this.rules.url.exec(src))) {
593 src = src.substring(cap[0].length);
594 text = escape(cap[1]);
596 out += this.renderer.link(href, null, text);
601 if (cap = this.rules.tag.exec(src)) {
602 if (!this.inLink && /^<a /i.test(cap[0])) {
604 } else if (this.inLink && /^<\/a>/i.test(cap[0])) {
607 src = src.substring(cap[0].length);
608 out += this.options.sanitize
615 if (cap = this.rules.link.exec(src)) {
616 src = src.substring(cap[0].length);
618 out += this.outputLink(cap, {
627 if ((cap = this.rules.reflink.exec(src))
628 || (cap = this.rules.nolink.exec(src))) {
629 src = src.substring(cap[0].length);
630 link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
631 link = this.links[link.toLowerCase()];
632 if (!link || !link.href) {
633 out += cap[0].charAt(0);
634 src = cap[0].substring(1) + src;
638 out += this.outputLink(cap, link);
644 if (cap = this.rules.strong.exec(src)) {
645 src = src.substring(cap[0].length);
646 out += this.renderer.strong(this.output(cap[2] || cap[1]));
651 if (cap = this.rules.em.exec(src)) {
652 src = src.substring(cap[0].length);
653 out += this.renderer.em(this.output(cap[2] || cap[1]));
658 if (cap = this.rules.code.exec(src)) {
659 src = src.substring(cap[0].length);
660 out += this.renderer.codespan(escape(cap[2], true));
665 if (cap = this.rules.br.exec(src)) {
666 src = src.substring(cap[0].length);
667 out += this.renderer.br();
672 if (cap = this.rules.del.exec(src)) {
673 src = src.substring(cap[0].length);
674 out += this.renderer.del(this.output(cap[1]));
679 if (cap = this.rules.text.exec(src)) {
680 src = src.substring(cap[0].length);
681 out += escape(this.smartypants(cap[0]));
687 Error('Infinite loop on byte: ' + src.charCodeAt(0));
698 InlineLexer.prototype.outputLink = function(cap, link) {
699 var href = escape(link.href)
700 , title = link.title ? escape(link.title) : null;
702 return cap[0].charAt(0) !== '!'
703 ? this.renderer.link(href, title, this.output(cap[1]))
704 : this.renderer.image(href, title, escape(cap[1]));
708 * Smartypants Transformations
711 InlineLexer.prototype.smartypants = function(text) {
712 if (!this.options.smartypants) return text;
715 .replace(/--/g, '\u2014')
717 .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018')
718 // closing singles & apostrophes
719 .replace(/'/g, '\u2019')
721 .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c')
723 .replace(/"/g, '\u201d')
725 .replace(/\.{3}/g, '\u2026');
732 InlineLexer.prototype.mangle = function(text) {
739 ch = text.charCodeAt(i);
740 if (Math.random() > 0.5) {
741 ch = 'x' + ch.toString(16);
743 out += '&#' + ch + ';';
753 function Renderer(options) {
754 this.options = options || {};
757 Renderer.prototype.code = function(code, lang, escaped) {
758 if (this.options.highlight) {
759 var out = this.options.highlight(code, lang);
760 if (out != null && out !== code) {
768 + (escaped ? code : escape(code, true))
772 return '<pre><code class="'
773 + this.options.langPrefix
776 + (escaped ? code : escape(code, true))
777 + '\n</code></pre>\n';
780 Renderer.prototype.blockquote = function(quote) {
781 return '<blockquote>\n' + quote + '</blockquote>\n';
784 Renderer.prototype.html = function(html) {
788 Renderer.prototype.heading = function(text, level, raw) {
792 + this.options.headerPrefix
793 + raw.toLowerCase().replace(/[^\w]+/g, '-')
801 Renderer.prototype.hr = function() {
802 return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
805 Renderer.prototype.list = function(body, ordered) {
806 var type = ordered ? 'ol' : 'ul';
807 return '<' + type + '>\n' + body + '</' + type + '>\n';
810 Renderer.prototype.listitem = function(text) {
811 return '<li>' + text + '</li>\n';
814 Renderer.prototype.paragraph = function(text) {
815 return '<p>' + text + '</p>\n';
818 Renderer.prototype.table = function(header, body) {
829 Renderer.prototype.tablerow = function(content) {
830 return '<tr>\n' + content + '</tr>\n';
833 Renderer.prototype.tablecell = function(content, flags) {
834 var type = flags.header ? 'th' : 'td';
835 var tag = flags.align
836 ? '<' + type + ' style="text-align:' + flags.align + '">'
838 return tag + content + '</' + type + '>\n';
841 // span level renderer
842 Renderer.prototype.strong = function(text) {
843 return '<strong>' + text + '</strong>';
846 Renderer.prototype.em = function(text) {
847 return '<em>' + text + '</em>';
850 Renderer.prototype.codespan = function(text) {
851 return '<code>' + text + '</code>';
854 Renderer.prototype.br = function() {
855 return this.options.xhtml ? '<br/>' : '<br>';
858 Renderer.prototype.del = function(text) {
859 return '<del>' + text + '</del>';
862 Renderer.prototype.link = function(href, title, text) {
863 if (this.options.sanitize) {
865 var prot = decodeURIComponent(unescape(href))
866 .replace(/[^\w:]/g, '')
871 if (prot.indexOf('javascript:') === 0) {
875 var out = '<a href="' + href + '"';
877 out += ' title="' + title + '"';
879 out += '>' + text + '</a>';
883 Renderer.prototype.image = function(href, title, text) {
884 var out = '<img src="' + href + '" alt="' + text + '"';
886 out += ' title="' + title + '"';
888 out += this.options.xhtml ? '/>' : '>';
893 * Parsing & Compiling
896 function Parser(options) {
899 this.options = options || marked.defaults;
900 this.options.renderer = this.options.renderer || new Renderer;
901 this.renderer = this.options.renderer;
902 this.renderer.options = this.options;
906 * Static Parse Method
909 Parser.parse = function(src, options, renderer) {
910 var parser = new Parser(options, renderer);
911 return parser.parse(src);
918 Parser.prototype.parse = function(src) {
919 this.inline = new InlineLexer(src.links, this.options, this.renderer);
920 this.tokens = src.reverse();
923 while (this.next()) {
934 Parser.prototype.next = function() {
935 return this.token = this.tokens.pop();
942 Parser.prototype.peek = function() {
943 return this.tokens[this.tokens.length - 1] || 0;
950 Parser.prototype.parseText = function() {
951 var body = this.token.text;
953 while (this.peek().type === 'text') {
954 body += '\n' + this.next().text;
957 return this.inline.output(body);
961 * Parse Current Token
964 Parser.prototype.tok = function() {
965 switch (this.token.type) {
970 return this.renderer.hr();
973 return this.renderer.heading(
974 this.inline.output(this.token.text),
979 return this.renderer.code(this.token.text,
994 for (i = 0; i < this.token.header.length; i++) {
995 flags = { header: true, align: this.token.align[i] };
996 cell += this.renderer.tablecell(
997 this.inline.output(this.token.header[i]),
998 { header: true, align: this.token.align[i] }
1001 header += this.renderer.tablerow(cell);
1003 for (i = 0; i < this.token.cells.length; i++) {
1004 row = this.token.cells[i];
1007 for (j = 0; j < row.length; j++) {
1008 cell += this.renderer.tablecell(
1009 this.inline.output(row[j]),
1010 { header: false, align: this.token.align[j] }
1014 body += this.renderer.tablerow(cell);
1016 return this.renderer.table(header, body);
1018 case 'blockquote_start': {
1021 while (this.next().type !== 'blockquote_end') {
1025 return this.renderer.blockquote(body);
1027 case 'list_start': {
1029 , ordered = this.token.ordered;
1031 while (this.next().type !== 'list_end') {
1035 return this.renderer.list(body, ordered);
1037 case 'list_item_start': {
1040 while (this.next().type !== 'list_item_end') {
1041 body += this.token.type === 'text'
1046 return this.renderer.listitem(body);
1048 case 'loose_item_start': {
1051 while (this.next().type !== 'list_item_end') {
1055 return this.renderer.listitem(body);
1058 var html = !this.token.pre && !this.options.pedantic
1059 ? this.inline.output(this.token.text)
1061 return this.renderer.html(html);
1064 return this.renderer.paragraph(this.inline.output(this.token.text));
1067 return this.renderer.paragraph(this.parseText());
1076 function escape(html, encode) {
1078 .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&')
1079 .replace(/</g, '<')
1080 .replace(/>/g, '>')
1081 .replace(/"/g, '"')
1082 .replace(/'/g, ''');
1085 function unescape(html) {
1086 return html.replace(/&([#\w]+);/g, function(_, n) {
1087 n = n.toLowerCase();
1088 if (n === 'colon') return ':';
1089 if (n.charAt(0) === '#') {
1090 return n.charAt(1) === 'x'
1091 ? String.fromCharCode(parseInt(n.substring(2), 16))
1092 : String.fromCharCode(+n.substring(1));
1098 function replace(regex, opt) {
1099 regex = regex.source;
1101 return function self(name, val) {
1102 if (!name) return new RegExp(regex, opt);
1103 val = val.source || val;
1104 val = val.replace(/(^|[^\[])\^/g, '$1');
1105 regex = regex.replace(name, val);
1113 function merge(obj) {
1118 for (; i < arguments.length; i++) {
1119 target = arguments[i];
1120 for (key in target) {
1121 if (Object.prototype.hasOwnProperty.call(target, key)) {
1122 obj[key] = target[key];
1135 function marked(src, opt, callback) {
1136 if (callback || typeof opt === 'function') {
1142 opt = merge({}, marked.defaults, opt || {});
1144 var highlight = opt.highlight
1150 tokens = Lexer.lex(src, opt)
1155 pending = tokens.length;
1157 var done = function(err) {
1159 opt.highlight = highlight;
1160 return callback(err);
1166 out = Parser.parse(tokens, opt);
1171 opt.highlight = highlight;
1175 : callback(null, out);
1178 if (!highlight || highlight.length < 3) {
1182 delete opt.highlight;
1184 if (!pending) return done();
1186 for (; i < tokens.length; i++) {
1188 if (token.type !== 'code') {
1189 return --pending || done();
1191 return highlight(token.text, token.lang, function(err, code) {
1192 if (err) return done(err);
1193 if (code == null || code === token.text) {
1194 return --pending || done();
1197 token.escaped = true;
1198 --pending || done();
1206 if (opt) opt = merge({}, marked.defaults, opt);
1207 return Parser.parse(Lexer.lex(src, opt), opt);
1209 e.message += '\nPlease report this to https://github.com/chjj/marked.';
1210 if ((opt || marked.defaults).silent) {
1211 return '<p>An error occured:</p><pre>'
1212 + escape(e.message + '', true)
1224 marked.setOptions = function(opt) {
1225 merge(marked.defaults, opt);
1238 langPrefix: 'lang-',
1241 renderer: new Renderer,
1249 marked.Parser = Parser;
1250 marked.parser = Parser.parse;
1252 marked.Renderer = Renderer;
1254 marked.Lexer = Lexer;
1255 marked.lexer = Lexer.lex;
1257 marked.InlineLexer = InlineLexer;
1258 marked.inlineLexer = InlineLexer.output;
1260 marked.parse = marked;
1262 if (typeof module !== 'undefined' && typeof exports === 'object') {
1263 module.exports = marked;
1264 } else if (typeof define === 'function' && define.amd) {
1265 define(function() { return marked; });
1267 this.marked = marked;
1270 }).call(function() {
1271 return this || (typeof window !== 'undefined' ? window : global);