I made this back in late 2014 and haven't touched it since then.
",handler:function(w){var lookaheadRegExp=new RegExp(this.lookahead,"mg");lookaheadRegExp.lastIndex=w.matchStart;var lookaheadMatch=lookaheadRegExp.exec(w.source);if(lookaheadMatch&&lookaheadMatch.index==w.matchStart){var e=insertElement(w.output,"span");e.innerHTML=lookaheadMatch[1];w.nextMatch=lookaheadMatch.index+lookaheadMatch[0].length}}},{name:"commentByBlock",match:"/%",lookahead:"/%((?:.|\\n)*?)%/",handler:function(w){var lookaheadRegExp=new RegExp(this.lookahead,"mg");lookaheadRegExp.lastIndex=w.matchStart;var lookaheadMatch=lookaheadRegExp.exec(w.source);if(lookaheadMatch&&lookaheadMatch.index==w.matchStart){w.nextMatch=lookaheadMatch.index+lookaheadMatch[0].length}}},{name:"boldByChar",match:"''",terminator:"''",element:"strong",handler:Wikifier.formatHelpers.charFormatHelper},{name:"strikeByChar",match:"==",terminator:"==",element:"strike",handler:Wikifier.formatHelpers.charFormatHelper},{name:"underlineByChar",match:"__",terminator:"__",element:"u",handler:Wikifier.formatHelpers.charFormatHelper},{name:"italicByChar",match:"//",terminator:"//",element:"em",handler:Wikifier.formatHelpers.charFormatHelper},{name:"subscriptByChar",match:"~~",terminator:"~~",element:"sub",handler:Wikifier.formatHelpers.charFormatHelper},{name:"superscriptByChar",match:"\\^\\^",terminator:"\\^\\^",element:"sup",handler:Wikifier.formatHelpers.charFormatHelper},{name:"monospacedByChar",match:"\\{\\{\\{",lookahead:"\\{\\{\\{((?:.|\\n)*?)\\}\\}\\}",handler:function(w){var lookaheadRegExp=new RegExp(this.lookahead,"mg");lookaheadRegExp.lastIndex=w.matchStart;var lookaheadMatch=lookaheadRegExp.exec(w.source);if(lookaheadMatch&&lookaheadMatch.index==w.matchStart){var e=insertElement(w.output,"code",null,null,lookaheadMatch[1]);w.nextMatch=lookaheadMatch.index+lookaheadMatch[0].length}}},(Wikifier.styleByCharFormatter={name:"styleByChar",match:"@@",terminator:"@@",lookahead:"(?:([^\\(@]+)\\(([^\\)\\|\\n]+)(?:\\):))|(?:([^\\.:@]+):([^;\\|\\n]+);)|(?:\\.([^;\\|\\n]+);)",handler:function(w){var e=insertElement(w.output,"span",null,null,null);var styles=Wikifier.formatHelpers.inlineCssHelper(w);if(styles.length==0){e.className="marked"}else{for(var t=0;t\\s]+))?)+\\s*|\\s*)\\/?)>",tagname:"<(\\w+)",voids:["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],tableElems:["table","thead","tbody","tfoot","th","tr","td","colgroup","col","caption","figcaption"],cleanupTables:function(e){var i,name,elems=[].slice.call(e.children);for(i=0;i";isvoid=(this.voids.indexOf(tn)!=-1);isstyle=tn=="style"||tn=="script";lookaheadRegExp=new RegExp(lookahead,"mg");lookaheadRegExp.lastIndex=a.matchStart;lookaheadMatch=lookaheadRegExp.exec(a.source);if(lookaheadMatch||isvoid){if(isstyle){e=document.createElement(tn);e.type="text/css";tmp=a.source.slice(a.nextMatch,lookaheadMatch.index);e.styleSheet?(e.styleSheet.cssText=tmp):(e.innerHTML=tmp);a.nextMatch=lookaheadMatch.index+lookaheadMatch[0].length}else{e=document.createElement(a.output.tagName);e.innerHTML=a.matchText;while(e.firstChild){e=e.firstChild}if(!isvoid){a.subWikify(e,lookahead)}}if(e.tagName.toLowerCase()=="table"){this.cleanupTables.call(this,e)}if(setter=e.getAttribute("data-setter")){setter=Wikifier.linkFormatter.makeCallback(setter)}if(passage=e.getAttribute("data-passage")){if(tn!="img"){addClickHandler(e,Wikifier.linkFunction(Wikifier.parsePassageTitle(passage),e,setter));if(tn=="area"||tn=="a"){e.setAttribute("href","javascript:;")}}else{Wikifier.imageFormatter.importedImage(e,passage)}}a.output.appendChild(e)}else{throwError(a.output,"HTML tag '"+tn+"' wasn't closed.",a.matchText)}}}}];Wikifier.charSpanFormatter={name:"char",match:"[^\n]",handler:function(a){insertElement(a.output,"span",null,"char",a.matchText).setAttribute("data-char",a.matchText==" "?"space":a.matchText=="\t"?"tab":a.matchText)}};Wikifier.parsePassageTitle=function(title){if(title&&!tale.has(title)){try{title=(internalEval(this.parse(title))||title)+""}catch(e){}}return title};Wikifier.linkFunction=function(title,el,callback){return function(){if(state.rewindTo){var passage=findPassageParent(el);if(passage&&passage.parentNode.lastChild!=passage){state.rewindTo(passage,true)}}state.display(title,el,null,callback)}};Wikifier.createInternalLink=function(place,title,callback,type){var tag=(type=="button"?"button":"a"),suffix=(type=="button"?"Button":"Link"),el=insertElement(place,tag);if(tale.has(title)){el.className="internal"+suffix;if(visited(title)){el.className+=" visited"+suffix}}else{el.className="broken"+suffix}addClickHandler(el,Wikifier.linkFunction(title,el,callback));if(place){place.appendChild(el)}return el};Wikifier.createExternalLink=function(place,url,callback,type){var tag=(type=="button"?"button":"a"),el=insertElement(place,tag);el.href=url;el.className="external"+(type=="button"?"Button":"Link");el.target="_blank";if(typeof callback=="function"){addClickHandler(el,callback)}if(place){place.appendChild(el)}return el};function visited(e){var ret=0,i=0;if(!state){return 0 }e=e||state.history[0].passage.title;if(arguments.length>1){for(ret=state.history.length;i1){for(i=arguments.length-1;i>=1;i--)
...