2 * Copyright 2016 ZTE Corporation.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
24 code: /^( {4}[^\n]+\n*)+/,
26 hr: /^( *[-*_]){3,} *(?:\n+|$)/,
27 heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,
29 lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
30 blockquote: /^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,
31 list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
32 html: /^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,
33 def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,
35 paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,
39 block.bullet = /(?:[*+-]|\d+\.)/;
40 block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;
41 block.item = replace(block.item, 'gm')
42 (/bull/g, block.bullet)
45 block.list = replace(block.list)
46 (/bull/g, block.bullet)
47 ('hr', '\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))')
48 ('def', '\\n+(?=' + block.def.source + ')')
51 block.blockquote = replace(block.blockquote)
56 + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code'
57 + '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo'
58 + '|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b';
60 block.html = replace(block.html)
61 ('comment', /<!--[\s\S]*?-->/)
62 ('closed', /<(tag)[\s\S]+?<\/\1>/)
63 ('closing', /<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)
67 block.paragraph = replace(block.paragraph)
69 ('heading', block.heading)
70 ('lheading', block.lheading)
71 ('blockquote', block.blockquote)
72 ('tag', '<' + block._tag)
77 * Normal Block Grammar
80 block.normal = merge({}, block);
86 block.gfm = merge({}, block.normal, {
87 fences: /^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,
91 block.gfm.paragraph = replace(block.paragraph)
93 + block.gfm.fences.source.replace('\\1', '\\2') + '|'
94 + block.list.source.replace('\\1', '\\3') + '|')
98 * GFM + Tables Block Grammar
101 block.tables = merge({}, block.gfm, {
102 nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,
103 table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/
110 function Lexer(options) {
112 this.tokens.links = {};
113 this.options = options || marked.defaults;
114 this.rules = block.normal;
116 if (this.options.gfm) {
117 if (this.options.tables) {
118 this.rules = block.tables;
120 this.rules = block.gfm;
135 Lexer.lex = function(src, options) {
136 var lexer = new Lexer(options);
137 return lexer.lex(src);
144 Lexer.prototype.lex = function(src) {
146 .replace(/\r\n|\r/g, '\n')
148 .replace(/\u00a0/g, ' ')
149 .replace(/\u2424/g, '\n');
151 return this.token(src, true);
158 Lexer.prototype.token = function(src, top, bq) {
159 var src = src.replace(/^ +$/gm, '')
172 if (cap = this.rules.newline.exec(src)) {
173 src = src.substring(cap[0].length);
174 if (cap[0].length > 1) {
182 if (cap = this.rules.code.exec(src)) {
183 src = src.substring(cap[0].length);
184 cap = cap[0].replace(/^ {4}/gm, '');
187 text: !this.options.pedantic
188 ? cap.replace(/\n+$/, '')
195 if (cap = this.rules.fences.exec(src)) {
196 src = src.substring(cap[0].length);
206 if (cap = this.rules.heading.exec(src)) {
207 src = src.substring(cap[0].length);
210 depth: cap[1].length,
216 // table no leading pipe (gfm)
217 if (top && (cap = this.rules.nptable.exec(src))) {
218 src = src.substring(cap[0].length);
222 header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
223 align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
224 cells: cap[3].replace(/\n$/, '').split('\n')
227 for (i = 0; i < item.align.length; i++) {
228 if (/^ *-+: *$/.test(item.align[i])) {
229 item.align[i] = 'right';
230 } else if (/^ *:-+: *$/.test(item.align[i])) {
231 item.align[i] = 'center';
232 } else if (/^ *:-+ *$/.test(item.align[i])) {
233 item.align[i] = 'left';
235 item.align[i] = null;
239 for (i = 0; i < item.cells.length; i++) {
240 item.cells[i] = item.cells[i].split(/ *\| */);
243 this.tokens.push(item);
249 if (cap = this.rules.lheading.exec(src)) {
250 src = src.substring(cap[0].length);
253 depth: cap[2] === '=' ? 1 : 2,
260 if (cap = this.rules.hr.exec(src)) {
261 src = src.substring(cap[0].length);
269 if (cap = this.rules.blockquote.exec(src)) {
270 src = src.substring(cap[0].length);
273 type: 'blockquote_start'
276 cap = cap[0].replace(/^ *> ?/gm, '');
278 // Pass `top` to keep the current
279 // "toplevel" state. This is exactly
280 // how markdown.pl works.
281 this.token(cap, top, true);
284 type: 'blockquote_end'
291 if (cap = this.rules.list.exec(src)) {
292 src = src.substring(cap[0].length);
297 ordered: bull.length > 1
300 // Get each top-level item.
301 cap = cap[0].match(this.rules.item);
310 // Remove the list item's bullet
311 // so it is seen as the next token.
313 item = item.replace(/^ *([*+-]|\d+\.) +/, '');
315 // Outdent whatever the
316 // list item contains. Hacky.
317 if (~item.indexOf('\n ')) {
318 space -= item.length;
319 item = !this.options.pedantic
320 ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '')
321 : item.replace(/^ {1,4}/gm, '');
324 // Determine whether the next list item belongs here.
325 // Backpedal if it does not belong in this list.
326 if (this.options.smartLists && i !== l - 1) {
327 b = block.bullet.exec(cap[i + 1])[0];
328 if (bull !== b && !(bull.length > 1 && b.length > 1)) {
329 src = cap.slice(i + 1).join('\n') + src;
334 // Determine whether item is loose or not.
335 // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
336 // for discount behavior.
337 loose = next || /\n\n(?!\s*$)/.test(item);
339 next = item.charAt(item.length - 1) === '\n';
340 if (!loose) loose = next;
350 this.token(item, false, bq);
353 type: 'list_item_end'
365 if (cap = this.rules.html.exec(src)) {
366 src = src.substring(cap[0].length);
368 type: this.options.sanitize
371 pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',
378 if ((!bq && top) && (cap = this.rules.def.exec(src))) {
379 src = src.substring(cap[0].length);
380 this.tokens.links[cap[1].toLowerCase()] = {
388 if (top && (cap = this.rules.table.exec(src))) {
389 src = src.substring(cap[0].length);
393 header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
394 align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
395 cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n')
398 for (i = 0; i < item.align.length; i++) {
399 if (/^ *-+: *$/.test(item.align[i])) {
400 item.align[i] = 'right';
401 } else if (/^ *:-+: *$/.test(item.align[i])) {
402 item.align[i] = 'center';
403 } else if (/^ *:-+ *$/.test(item.align[i])) {
404 item.align[i] = 'left';
406 item.align[i] = null;
410 for (i = 0; i < item.cells.length; i++) {
411 item.cells[i] = item.cells[i]
412 .replace(/^ *\| *| *\| *$/g, '')
416 this.tokens.push(item);
421 // top-level paragraph
422 if (top && (cap = this.rules.paragraph.exec(src))) {
423 src = src.substring(cap[0].length);
426 text: cap[1].charAt(cap[1].length - 1) === '\n'
427 ? cap[1].slice(0, -1)
434 if (cap = this.rules.text.exec(src)) {
435 // Top-level should never reach here.
436 src = src.substring(cap[0].length);
446 Error('Infinite loop on byte: ' + src.charCodeAt(0));
454 * Inline-Level Grammar
458 escape: /^\\([\\`*{}\[\]()#+\-.!_>])/,
459 autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
461 tag: /^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,
462 link: /^!?\[(inside)\]\(href\)/,
463 reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/,
464 nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,
465 strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,
466 em: /^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
467 code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,
468 br: /^ {2,}\n(?!\s*$)/,
470 text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/
473 inline._inside = /(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/;
474 inline._href = /\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;
476 inline.link = replace(inline.link)
477 ('inside', inline._inside)
478 ('href', inline._href)
481 inline.reflink = replace(inline.reflink)
482 ('inside', inline._inside)
486 * Normal Inline Grammar
489 inline.normal = merge({}, inline);
492 * Pedantic Inline Grammar
495 inline.pedantic = merge({}, inline.normal, {
496 strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
497 em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/
504 inline.gfm = merge({}, inline.normal, {
505 escape: replace(inline.escape)('])', '~|])')(),
506 url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,
507 del: /^~~(?=\S)([\s\S]*?\S)~~/,
508 text: replace(inline.text)
515 * GFM + Line Breaks Inline Grammar
518 inline.breaks = merge({}, inline.gfm, {
519 br: replace(inline.br)('{2,}', '*')(),
520 text: replace(inline.gfm.text)('{2,}', '*')()
524 * Inline Lexer & Compiler
527 function InlineLexer(links, options) {
528 this.options = options || marked.defaults;
530 this.rules = inline.normal;
531 this.renderer = this.options.renderer || new Renderer;
532 this.renderer.options = this.options;
536 Error('Tokens array requires a `links` property.');
539 if (this.options.gfm) {
540 if (this.options.breaks) {
541 this.rules = inline.breaks;
543 this.rules = inline.gfm;
545 } else if (this.options.pedantic) {
546 this.rules = inline.pedantic;
551 * Expose Inline Rules
554 InlineLexer.rules = inline;
557 * Static Lexing/Compiling Method
560 InlineLexer.output = function(src, links, options) {
561 var inline = new InlineLexer(links, options);
562 return inline.output(src);
569 InlineLexer.prototype.output = function(src) {
578 if (cap = this.rules.escape.exec(src)) {
579 src = src.substring(cap[0].length);
585 if (cap = this.rules.autolink.exec(src)) {
586 src = src.substring(cap[0].length);
587 if (cap[2] === '@') {
588 text = cap[1].charAt(6) === ':'
589 ? this.mangle(cap[1].substring(7))
590 : this.mangle(cap[1]);
591 href = this.mangle('mailto:') + text;
593 text = escape(cap[1]);
596 out += this.renderer.link(href, null, text);
601 if (!this.inLink && (cap = this.rules.url.exec(src))) {
602 src = src.substring(cap[0].length);
603 text = escape(cap[1]);
605 out += this.renderer.link(href, null, text);
610 if (cap = this.rules.tag.exec(src)) {
611 if (!this.inLink && /^<a /i.test(cap[0])) {
613 } else if (this.inLink && /^<\/a>/i.test(cap[0])) {
616 src = src.substring(cap[0].length);
617 out += this.options.sanitize
624 if (cap = this.rules.link.exec(src)) {
625 src = src.substring(cap[0].length);
627 out += this.outputLink(cap, {
636 if ((cap = this.rules.reflink.exec(src))
637 || (cap = this.rules.nolink.exec(src))) {
638 src = src.substring(cap[0].length);
639 link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
640 link = this.links[link.toLowerCase()];
641 if (!link || !link.href) {
642 out += cap[0].charAt(0);
643 src = cap[0].substring(1) + src;
647 out += this.outputLink(cap, link);
653 if (cap = this.rules.strong.exec(src)) {
654 src = src.substring(cap[0].length);
655 out += this.renderer.strong(this.output(cap[2] || cap[1]));
660 if (cap = this.rules.em.exec(src)) {
661 src = src.substring(cap[0].length);
662 out += this.renderer.em(this.output(cap[2] || cap[1]));
667 if (cap = this.rules.code.exec(src)) {
668 src = src.substring(cap[0].length);
669 out += this.renderer.codespan(escape(cap[2], true));
674 if (cap = this.rules.br.exec(src)) {
675 src = src.substring(cap[0].length);
676 out += this.renderer.br();
681 if (cap = this.rules.del.exec(src)) {
682 src = src.substring(cap[0].length);
683 out += this.renderer.del(this.output(cap[1]));
688 if (cap = this.rules.text.exec(src)) {
689 src = src.substring(cap[0].length);
690 out += escape(this.smartypants(cap[0]));
696 Error('Infinite loop on byte: ' + src.charCodeAt(0));
707 InlineLexer.prototype.outputLink = function(cap, link) {
708 var href = escape(link.href)
709 , title = link.title ? escape(link.title) : null;
711 return cap[0].charAt(0) !== '!'
712 ? this.renderer.link(href, title, this.output(cap[1]))
713 : this.renderer.image(href, title, escape(cap[1]));
717 * Smartypants Transformations
720 InlineLexer.prototype.smartypants = function(text) {
721 if (!this.options.smartypants) return text;
724 .replace(/--/g, '\u2014')
726 .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018')
727 // closing singles & apostrophes
728 .replace(/'/g, '\u2019')
730 .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c')
732 .replace(/"/g, '\u201d')
734 .replace(/\.{3}/g, '\u2026');
741 InlineLexer.prototype.mangle = function(text) {
748 ch = text.charCodeAt(i);
749 if (Math.random() > 0.5) {
750 ch = 'x' + ch.toString(16);
752 out += '&#' + ch + ';';
762 function Renderer(options) {
763 this.options = options || {};
766 Renderer.prototype.code = function(code, lang, escaped) {
767 if (this.options.highlight) {
768 var out = this.options.highlight(code, lang);
769 if (out != null && out !== code) {
777 + (escaped ? code : escape(code, true))
781 return '<pre><code class="'
782 + this.options.langPrefix
785 + (escaped ? code : escape(code, true))
786 + '\n</code></pre>\n';
789 Renderer.prototype.blockquote = function(quote) {
790 return '<blockquote>\n' + quote + '</blockquote>\n';
793 Renderer.prototype.html = function(html) {
797 Renderer.prototype.heading = function(text, level, raw) {
801 + this.options.headerPrefix
802 + raw.toLowerCase().replace(/[^\w]+/g, '-')
810 Renderer.prototype.hr = function() {
811 return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
814 Renderer.prototype.list = function(body, ordered) {
815 var type = ordered ? 'ol' : 'ul';
816 return '<' + type + '>\n' + body + '</' + type + '>\n';
819 Renderer.prototype.listitem = function(text) {
820 return '<li>' + text + '</li>\n';
823 Renderer.prototype.paragraph = function(text) {
824 return '<p>' + text + '</p>\n';
827 Renderer.prototype.table = function(header, body) {
838 Renderer.prototype.tablerow = function(content) {
839 return '<tr>\n' + content + '</tr>\n';
842 Renderer.prototype.tablecell = function(content, flags) {
843 var type = flags.header ? 'th' : 'td';
844 var tag = flags.align
845 ? '<' + type + ' style="text-align:' + flags.align + '">'
847 return tag + content + '</' + type + '>\n';
850 // span level renderer
851 Renderer.prototype.strong = function(text) {
852 return '<strong>' + text + '</strong>';
855 Renderer.prototype.em = function(text) {
856 return '<em>' + text + '</em>';
859 Renderer.prototype.codespan = function(text) {
860 return '<code>' + text + '</code>';
863 Renderer.prototype.br = function() {
864 return this.options.xhtml ? '<br/>' : '<br>';
867 Renderer.prototype.del = function(text) {
868 return '<del>' + text + '</del>';
871 Renderer.prototype.link = function(href, title, text) {
872 if (this.options.sanitize) {
874 var prot = decodeURIComponent(unescape(href))
875 .replace(/[^\w:]/g, '')
880 if (prot.indexOf('javascript:') === 0) {
884 var out = '<a href="' + href + '"';
886 out += ' title="' + title + '"';
888 out += '>' + text + '</a>';
892 Renderer.prototype.image = function(href, title, text) {
893 var out = '<img src="' + href + '" alt="' + text + '"';
895 out += ' title="' + title + '"';
897 out += this.options.xhtml ? '/>' : '>';
902 * Parsing & Compiling
905 function Parser(options) {
908 this.options = options || marked.defaults;
909 this.options.renderer = this.options.renderer || new Renderer;
910 this.renderer = this.options.renderer;
911 this.renderer.options = this.options;
915 * Static Parse Method
918 Parser.parse = function(src, options, renderer) {
919 var parser = new Parser(options, renderer);
920 return parser.parse(src);
927 Parser.prototype.parse = function(src) {
928 this.inline = new InlineLexer(src.links, this.options, this.renderer);
929 this.tokens = src.reverse();
932 while (this.next()) {
943 Parser.prototype.next = function() {
944 return this.token = this.tokens.pop();
951 Parser.prototype.peek = function() {
952 return this.tokens[this.tokens.length - 1] || 0;
959 Parser.prototype.parseText = function() {
960 var body = this.token.text;
962 while (this.peek().type === 'text') {
963 body += '\n' + this.next().text;
966 return this.inline.output(body);
970 * Parse Current Token
973 Parser.prototype.tok = function() {
974 switch (this.token.type) {
979 return this.renderer.hr();
982 return this.renderer.heading(
983 this.inline.output(this.token.text),
988 return this.renderer.code(this.token.text,
1003 for (i = 0; i < this.token.header.length; i++) {
1004 flags = { header: true, align: this.token.align[i] };
1005 cell += this.renderer.tablecell(
1006 this.inline.output(this.token.header[i]),
1007 { header: true, align: this.token.align[i] }
1010 header += this.renderer.tablerow(cell);
1012 for (i = 0; i < this.token.cells.length; i++) {
1013 row = this.token.cells[i];
1016 for (j = 0; j < row.length; j++) {
1017 cell += this.renderer.tablecell(
1018 this.inline.output(row[j]),
1019 { header: false, align: this.token.align[j] }
1023 body += this.renderer.tablerow(cell);
1025 return this.renderer.table(header, body);
1027 case 'blockquote_start': {
1030 while (this.next().type !== 'blockquote_end') {
1034 return this.renderer.blockquote(body);
1036 case 'list_start': {
1038 , ordered = this.token.ordered;
1040 while (this.next().type !== 'list_end') {
1044 return this.renderer.list(body, ordered);
1046 case 'list_item_start': {
1049 while (this.next().type !== 'list_item_end') {
1050 body += this.token.type === 'text'
1055 return this.renderer.listitem(body);
1057 case 'loose_item_start': {
1060 while (this.next().type !== 'list_item_end') {
1064 return this.renderer.listitem(body);
1067 var html = !this.token.pre && !this.options.pedantic
1068 ? this.inline.output(this.token.text)
1070 return this.renderer.html(html);
1073 return this.renderer.paragraph(this.inline.output(this.token.text));
1076 return this.renderer.paragraph(this.parseText());
1085 function escape(html, encode) {
1087 .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&')
1088 .replace(/</g, '<')
1089 .replace(/>/g, '>')
1090 .replace(/"/g, '"')
1091 .replace(/'/g, ''');
1094 function unescape(html) {
1095 return html.replace(/&([#\w]+);/g, function(_, n) {
1096 n = n.toLowerCase();
1097 if (n === 'colon') return ':';
1098 if (n.charAt(0) === '#') {
1099 return n.charAt(1) === 'x'
1100 ? String.fromCharCode(parseInt(n.substring(2), 16))
1101 : String.fromCharCode(+n.substring(1));
1107 function replace(regex, opt) {
1108 regex = regex.source;
1110 return function self(name, val) {
1111 if (!name) return new RegExp(regex, opt);
1112 val = val.source || val;
1113 val = val.replace(/(^|[^\[])\^/g, '$1');
1114 regex = regex.replace(name, val);
1122 function merge(obj) {
1127 for (; i < arguments.length; i++) {
1128 target = arguments[i];
1129 for (key in target) {
1130 if (Object.prototype.hasOwnProperty.call(target, key)) {
1131 obj[key] = target[key];
1144 function marked(src, opt, callback) {
1145 if (callback || typeof opt === 'function') {
1151 opt = merge({}, marked.defaults, opt || {});
1153 var highlight = opt.highlight
1159 tokens = Lexer.lex(src, opt)
1164 pending = tokens.length;
1166 var done = function(err) {
1168 opt.highlight = highlight;
1169 return callback(err);
1175 out = Parser.parse(tokens, opt);
1180 opt.highlight = highlight;
1184 : callback(null, out);
1187 if (!highlight || highlight.length < 3) {
1191 delete opt.highlight;
1193 if (!pending) return done();
1195 for (; i < tokens.length; i++) {
1197 if (token.type !== 'code') {
1198 return --pending || done();
1200 return highlight(token.text, token.lang, function(err, code) {
1201 if (err) return done(err);
1202 if (code == null || code === token.text) {
1203 return --pending || done();
1206 token.escaped = true;
1207 --pending || done();
1215 if (opt) opt = merge({}, marked.defaults, opt);
1216 return Parser.parse(Lexer.lex(src, opt), opt);
1218 e.message += '\nPlease report this to https://github.com/chjj/marked.';
1219 if ((opt || marked.defaults).silent) {
1220 return '<p>An error occured:</p><pre>'
1221 + escape(e.message + '', true)
1233 marked.setOptions = function(opt) {
1234 merge(marked.defaults, opt);
1247 langPrefix: 'lang-',
1250 renderer: new Renderer,
1258 marked.Parser = Parser;
1259 marked.parser = Parser.parse;
1261 marked.Renderer = Renderer;
1263 marked.Lexer = Lexer;
1264 marked.lexer = Lexer.lex;
1266 marked.InlineLexer = InlineLexer;
1267 marked.inlineLexer = InlineLexer.output;
1269 marked.parse = marked;
1271 if (typeof module !== 'undefined' && typeof exports === 'object') {
1272 module.exports = marked;
1273 } else if (typeof define === 'function' && define.amd) {
1274 define(function() { return marked; });
1276 this.marked = marked;
1279 }).call(function() {
1280 return this || (typeof window !== 'undefined' ? window : global);