From ef0c621d2599ca6d576f8a339c8b53a65e06f6b4 Mon Sep 17 00:00:00 2001 From: Joe Wroten Date: Thu, 6 Oct 2016 21:57:23 -0500 Subject: [PATCH] =?UTF-8?q?Configurable=20settings,=20themes=20changed,=20?= =?UTF-8?q?refactor=20=F0=9F=90=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.css | 14 ++++++++++++-- dist/app.js | 37 ++++++++++++++++++++++++------------- index.html | 35 ++++++++++++++++++++++++----------- package.json | 3 ++- src/app.js | 34 ++++++++++++++++++++++++---------- vendor/js/marked.min.js | 6 ++++++ 6 files changed, 92 insertions(+), 37 deletions(-) create mode 100644 vendor/js/marked.min.js diff --git a/app.css b/app.css index 4259ab8..dce2243 100644 --- a/app.css +++ b/app.css @@ -1,5 +1,15 @@ -#stack { - white-space: normal; +#howManyWords { + width: 3.5em; +} + +label { + display: inline; + margin-right: 1.5em; + text-transform: capitalize; +} + +button { + cursor: pointer; } /* Thanks to http://projects.lukehaas.me/css-loaders */ diff --git a/dist/app.js b/dist/app.js index 0eb8121..b3d4910 100644 --- a/dist/app.js +++ b/dist/app.js @@ -4,9 +4,10 @@ Array.prototype.random = function () { return this[Math.floor(Math.random() * this.length)]; }; -var wordThemes = ['candy', 'beer', 'coffee', 'car', 'liquor', 'mustache']; +var defaultWordThemes = ['candy', 'coffee', 'speed', 'liquor', 'facial hair']; +var defaultHowManyWords = 3; + var suffixes = ['', 'JS', 'Script', '.js', '.io', 'DB']; -var wordsToUse = 3; var stackPhrases = { intros: ['My prefered tech stack is a', 'I feel the best way to build ambitious apps is with a', 'An ideal stack would be a', 'I start off with a'], @@ -19,7 +20,18 @@ var app = new Vue({ el: '#app', data: { loading: true, - stack: '' + stack: '', + defaultWordThemes: defaultWordThemes, + wordThemes: defaultWordThemes, + howManyWords: defaultHowManyWords + }, + computed: { + stackMarkdown: function stackMarkdown() { + return marked(this.stack, { sanitize: true }); + }, + validSettings: function validSettings() { + return this.wordThemes.length && this.howManyWords > 0; + } }, methods: { newStack: function newStack() { @@ -38,16 +50,16 @@ var app = new Vue({ } }); -// Fire off a new stack request on load -app.newStack(); +app.newStack(); // Fire off a new stack request on load function generateStack() { - return Promise.all(wordThemes.map(function (w) { + return Promise.all(app.wordThemes.map(function (w) { return getWordsRelatedTo(w); })).then(function (data) { - return data.reduce(function (prev, cur) { - return [].concat(prev.length ? prev : [], cur.hasTypes); + data = data.map(function (d) { + return d.hasTypes; }); + return [].concat.apply([], data); }).then(wordsToStack); } @@ -60,13 +72,13 @@ function getWordsRelatedTo(word) { function wordsToStack(allWords) { var stack = stackPhrases.intros.random(); - for (var i = 1; i <= wordsToUse; i++) { + for (var i = 1; i <= app.howManyWords; i++) { var techWord = wordToTechTerm(allWords.random()); var variety = stackPhrases.toolVarieties.random(); var connection = stackPhrases.toolConnections.random(); var outro = stackPhrases.outros.random(); - var end = i < wordsToUse ? connection : outro; - stack += ' ' + techWord + ' ' + variety + ' ' + end; + var end = i < app.howManyWords ? connection : outro; + stack += ' **' + techWord + '** ' + variety + ' ' + end; } return stack; @@ -77,5 +89,4 @@ function wordToTechTerm(word) { return word.charAt(0).toUpperCase() + word.slice(1); }); // Capitalize each word return word.join('') + suffixes.random(); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9hcHAuanMiXSwibmFtZXMiOlsiQXJyYXkiLCJwcm90b3R5cGUiLCJyYW5kb20iLCJNYXRoIiwiZmxvb3IiLCJsZW5ndGgiLCJ3b3JkVGhlbWVzIiwic3VmZml4ZXMiLCJ3b3Jkc1RvVXNlIiwic3RhY2tQaHJhc2VzIiwiaW50cm9zIiwidG9vbFZhcmlldGllcyIsInRvb2xDb25uZWN0aW9ucyIsIm91dHJvcyIsImFwcCIsIlZ1ZSIsImVsIiwiZGF0YSIsImxvYWRpbmciLCJzdGFjayIsIm1ldGhvZHMiLCJuZXdTdGFjayIsImdhIiwiZ2Vu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GFja1BocmFzZXMudG9vbFZhcmlldGllcy5yYW5kb20oKTtcbiAgICBsZXQgY29ubmVjdGlvbiA9IHN0YWNrUGhyYXNlcy50b29sQ29ubmVjdGlvbnMucmFuZG9tKCk7XG4gICAgbGV0IG91dHJvID0gc3RhY2tQaHJhc2VzLm91dHJvcy5yYW5kb20oKTtcbiAgICBsZXQgZW5kID0gaSA8IHdvcmRzVG9Vc2UgPyBjb25uZWN0aW9uIDogb3V0cm87XG4gICAgc3RhY2sgKz0gYCAke3RlY2hXb3JkfSAke3ZhcmlldHl9ICR7ZW5kfWA7XG4gIH1cblxuICByZXR1cm4gc3RhY2s7XG59XG5cbmZ1bmN0aW9uIHdvcmRUb1RlY2hUZXJtKHdvcmQpIHtcbiAgd29yZCA9IHdvcmQuc3BsaXQoJyAnKS5tYXAod29yZCA9PiB3b3JkLmNoYXJBdCgwKS50b1VwcGVyQ2FzZSgpICsgd29yZC5zbGljZSgxKSk7IC8vIENhcGl0YWxpemUgZWFjaCB3b3JkXG4gIHJldHVybiB3b3JkLmpvaW4oJycpICsgc3VmZml4ZXMucmFuZG9tKCk7XG59XG4iXX0= \ No newline at end of file +} \ No newline at end of file diff --git a/index.html b/index.html index 58ffa3f..4bd55ad 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ Oh I Use... - + @@ -54,18 +54,30 @@

Oh I Use...

Loading...
-

- -
- {{ stack }} -
-
-
-

+

- + @@ -81,6 +93,7 @@ ga('send', 'pageview'); + diff --git a/package.json b/package.json index cc4724e..b310265 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "build": "npm run vendor && babel src --out-dir dist", "watch": "npm run vendor && babel src --watch --out-dir dist --source-maps inline", - "vendor": "mkdir -p ./vendor ./vendor/css ./vendor/js ./dist ./dist/favicon && cp -R ./src/favicon ./dist && cp -R ./node_modules/skeleton-css/css/ ./vendor/css && cp ./node_modules/vue/dist/vue.min.js ./vendor/js/vue.min.js && cp ./node_modules/whatwg-fetch/fetch.js ./vendor/js/fetch.js", + "vendor": "mkdir -p ./vendor ./vendor/css ./vendor/js ./dist ./dist/favicon && cp -R ./src/favicon ./dist && cp -R ./node_modules/skeleton-css/css/ ./vendor/css && cp ./node_modules/vue/dist/vue.min.js ./vendor/js/vue.min.js && cp ./node_modules/whatwg-fetch/fetch.js ./vendor/js/fetch.js && cp ./node_modules/marked/marked.min.js ./vendor/js/marked.min.js", "clean": "rm -rf ./vendor ./dist" }, "author": "Joe Wroten ", @@ -16,6 +16,7 @@ "babel-preset-es2015": "^6.16.0" }, "dependencies": { + "marked": "^0.3.6", "skeleton-css": "^2.0.4", "vue": "^2.0.1", "whatwg-fetch": "^1.0.0" diff --git a/src/app.js b/src/app.js index 231d34b..38f9d38 100644 --- a/src/app.js +++ b/src/app.js @@ -2,9 +2,10 @@ Array.prototype.random = function() { return this[Math.floor(Math.random() * this.length)]; } -let wordThemes = ['candy', 'beer', 'coffee', 'car', 'liquor', 'mustache']; +let defaultWordThemes = ['candy', 'coffee', 'speed', 'liquor', 'facial hair']; +let defaultHowManyWords = 3; + let suffixes = ['', 'JS', 'Script', '.js', '.io', 'DB']; -let wordsToUse = 3; let stackPhrases = { intros: [ @@ -43,7 +44,18 @@ let app = new Vue({ el: '#app', data: { loading: true, - stack: '' + stack: '', + defaultWordThemes, + wordThemes: defaultWordThemes, + howManyWords: defaultHowManyWords + }, + computed: { + stackMarkdown() { + return marked(this.stack, { sanitize: true }); + }, + validSettings() { + return this.wordThemes.length && this.howManyWords > 0; + } }, methods: { newStack() { @@ -62,12 +74,14 @@ let app = new Vue({ } }); -// Fire off a new stack request on load -app.newStack(); +app.newStack(); // Fire off a new stack request on load function generateStack() { - return Promise.all(wordThemes.map(w => getWordsRelatedTo(w))) - .then(data => data.reduce((prev, cur) => [].concat(prev.length ? prev : [], cur.hasTypes))) + return Promise.all(app.wordThemes.map(w => getWordsRelatedTo(w))) + .then(data => { + data = data.map(d => d.hasTypes); + return [].concat.apply([], data); + }) .then(wordsToStack); } @@ -79,13 +93,13 @@ function getWordsRelatedTo(word) { function wordsToStack(allWords) { let stack = stackPhrases.intros.random(); - for (let i = 1; i <= wordsToUse; i++) { + for (let i = 1; i <= app.howManyWords; i++) { let techWord = wordToTechTerm(allWords.random()); let variety = stackPhrases.toolVarieties.random(); let connection = stackPhrases.toolConnections.random(); let outro = stackPhrases.outros.random(); - let end = i < wordsToUse ? connection : outro; - stack += ` ${techWord} ${variety} ${end}`; + let end = i < app.howManyWords ? connection : outro; + stack += ` **${techWord}** ${variety} ${end}`; } return stack; diff --git a/vendor/js/marked.min.js b/vendor/js/marked.min.js new file mode 100644 index 0000000..555c1dc --- /dev/null +++ b/vendor/js/marked.min.js @@ -0,0 +1,6 @@ +/** + * marked - a markdown parser + * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) + * https://github.com/chjj/marked + */ +(function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\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:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+block.def.source+")")();block.blockquote=replace(block.blockquote)("def",block.def)();block._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";block.html=replace(block.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/});block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1","\\2")+"|"+block.list.source.replace("\\1","\\3")+"|")();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm){if(this.options.tables){this.rules=block.tables}else{this.rules=block.gfm}}}Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(src,true)};Lexer.prototype.token=function(src,top,bq){var src=src.replace(/^ +$/gm,""),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1){this.tokens.push({type:"space"})}}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,"");this.tokens.push({type:"code",text:!this.options.pedantic?cap.replace(/\n+$/,""):cap});continue}if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"code",lang:cap[2],text:cap[3]||""});continue}if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});continue}if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")};for(i=0;i ?/gm,"");this.token(cap,top,true);this.tokens.push({type:"blockquote_end"});continue}if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);bull=cap[2];this.tokens.push({type:"list_start",ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=false;l=cap.length;i=0;for(;i1&&b.length>1)){src=cap.slice(i+1).join("\n")+src;i=l-1}}loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item.charAt(item.length-1)==="\n";if(!loose)loose=next}this.tokens.push({type:loose?"loose_item_start":"list_item_start"});this.token(item,false,bq);this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&(cap[1]==="pre"||cap[1]==="script"||cap[1]==="style"),text:cap[0]});continue}if(!bq&&top&&(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)();inline.reflink=replace(inline.reflink)("inside",inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer;this.renderer.options=this.options;if(!this.links){throw new Error("Tokens array requires a `links` property.")}if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks}else{this.rules=inline.gfm}}else if(this.options.pedantic){this.rules=inline.pedantic}}InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out="",link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);out+=cap[1];continue}if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==="@"){text=cap[1].charAt(6)===":"?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle("mailto:")+text}else{text=escape(cap[1]);href=text}out+=this.renderer.link(href,null,text);continue}if(!this.inLink&&(cap=this.rules.url.exec(src))){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+=this.renderer.link(href,null,text);continue}if(cap=this.rules.tag.exec(src)){if(!this.inLink&&/^/i.test(cap[0])){this.inLink=false}src=src.substring(cap[0].length);out+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(cap[0]):escape(cap[0]):cap[0];continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);this.inLink=true;out+=this.outputLink(cap,{href:cap[2],title:cap[3]});this.inLink=false;continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g," ");link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0].charAt(0);src=cap[0].substring(1)+src;continue}this.inLink=true;out+=this.outputLink(cap,link);this.inLink=false;continue}if(cap=this.rules.strong.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.strong(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.em(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.codespan(escape(cap[2],true));continue}if(cap=this.rules.br.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.br();continue}if(cap=this.rules.del.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.del(this.output(cap[1]));continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.text(escape(this.smartypants(cap[0])));continue}if(src){throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}}return out};InlineLexer.prototype.outputLink=function(cap,link){var href=escape(link.href),title=link.title?escape(link.title):null;return cap[0].charAt(0)!=="!"?this.renderer.link(href,title,this.output(cap[1])):this.renderer.image(href,title,escape(cap[1]))};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants)return text;return text.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")};InlineLexer.prototype.mangle=function(text){if(!this.options.mangle)return text;var out="",l=text.length,i=0,ch;for(;i.5){ch="x"+ch.toString(16)}out+="&#"+ch+";"}return out};function Renderer(options){this.options=options||{}}Renderer.prototype.code=function(code,lang,escaped){if(this.options.highlight){var out=this.options.highlight(code,lang);if(out!=null&&out!==code){escaped=true;code=out}}if(!lang){return"
"+(escaped?code:escape(code,true))+"\n
"}return'
'+(escaped?code:escape(code,true))+"\n
\n"};Renderer.prototype.blockquote=function(quote){return"
\n"+quote+"
\n"};Renderer.prototype.html=function(html){return html};Renderer.prototype.heading=function(text,level,raw){return"'+text+"\n"};Renderer.prototype.hr=function(){return this.options.xhtml?"
\n":"
\n"};Renderer.prototype.list=function(body,ordered){var type=ordered?"ol":"ul";return"<"+type+">\n"+body+"\n"};Renderer.prototype.listitem=function(text){return"
  • "+text+"
  • \n"};Renderer.prototype.paragraph=function(text){return"

    "+text+"

    \n"};Renderer.prototype.table=function(header,body){return"\n"+"\n"+header+"\n"+"\n"+body+"\n"+"
    \n"};Renderer.prototype.tablerow=function(content){return"\n"+content+"\n"};Renderer.prototype.tablecell=function(content,flags){var type=flags.header?"th":"td";var tag=flags.align?"<"+type+' style="text-align:'+flags.align+'">':"<"+type+">";return tag+content+"\n"};Renderer.prototype.strong=function(text){return""+text+""};Renderer.prototype.em=function(text){return""+text+""};Renderer.prototype.codespan=function(text){return""+text+""};Renderer.prototype.br=function(){return this.options.xhtml?"
    ":"
    "};Renderer.prototype.del=function(text){return""+text+""};Renderer.prototype.link=function(href,title,text){if(this.options.sanitize){try{var prot=decodeURIComponent(unescape(href)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(prot.indexOf("javascript:")===0||prot.indexOf("vbscript:")===0){return""}}var out='
    ";return out};Renderer.prototype.image=function(href,title,text){var out=''+text+'":">";return out};Renderer.prototype.text=function(text){return text};function Parser(options){this.tokens=[];this.token=null;this.options=options||marked.defaults;this.options.renderer=this.options.renderer||new Renderer;this.renderer=this.options.renderer;this.renderer.options=this.options}Parser.parse=function(src,options,renderer){var parser=new Parser(options,renderer);return parser.parse(src)};Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options,this.renderer);this.tokens=src.reverse();var out="";while(this.next()){out+=this.tok()}return out};Parser.prototype.next=function(){return this.token=this.tokens.pop()};Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};Parser.prototype.parseText=function(){var body=this.token.text;while(this.peek().type==="text"){body+="\n"+this.next().text}return this.inline.output(body)};Parser.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,this.token.text)}case"code":{return this.renderer.code(this.token.text,this.token.lang,this.token.escaped)}case"table":{var header="",body="",i,row,cell,flags,j;cell="";for(i=0;i/g,">").replace(/"/g,""").replace(/'/g,"'")}function unescape(html){return html.replace(/&([#\w]+);/g,function(_,n){n=n.toLowerCase();if(n==="colon")return":";if(n.charAt(0)==="#"){return n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1))}return""})}function replace(regex,opt){regex=regex.source;opt=opt||"";return function self(name,val){if(!name)return new RegExp(regex,opt);val=val.source||val;val=val.replace(/(^|[^\[])\^/g,"$1");regex=regex.replace(name,val);return self}}function noop(){}noop.exec=noop;function merge(obj){var i=1,target,key;for(;iAn error occured:

    "+escape(e.message+"",true)+"
    "}throw e}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,sanitizer:null,mangle:true,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new Renderer,xhtml:false};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof module!=="undefined"&&typeof exports==="object"){module.exports=marked}else if(typeof define==="function"&&define.amd){define(function(){return marked})}else{this.marked=marked}}).call(function(){return this||(typeof window!=="undefined"?window:global)}()); \ No newline at end of file