aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2020-04-23 10:54:48 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2020-04-23 10:54:48 +0200
commitb92d16f48df6e6e16c0cd5d232a3e787e59af8f9 (patch)
treea78b552b2f9f4905cbda78283f3744e01dce9cb5
parent210fbb76467d3c0da8d66f3c42bccf9ec18993b6 (diff)
downloadfosdem-2021-minimalism-presentation-b92d16f48df6e6e16c0cd5d232a3e787e59af8f9.tar
fosdem-2021-minimalism-presentation-b92d16f48df6e6e16c0cd5d232a3e787e59af8f9.tar.gz
make plugins work with multiple presentations on same page
-rw-r--r--dist/plugin/highlight.js2
-rw-r--r--dist/plugin/markdown.js4
-rw-r--r--dist/plugin/math.js2
-rw-r--r--dist/plugin/search.js4
-rw-r--r--examples/multiple-presentations.html36
-rw-r--r--plugin/highlight/highlight.js18
-rwxr-xr-xplugin/markdown/markdown.js640
-rwxr-xr-xplugin/math/math.js49
-rw-r--r--plugin/search/search.js308
9 files changed, 564 insertions, 499 deletions
diff --git a/dist/plugin/highlight.js b/dist/plugin/highlight.js
index 56bf34e..96af7dc 100644
--- a/dist/plugin/highlight.js
+++ b/dist/plugin/highlight.js
@@ -3,4 +3,4 @@
/*!
* reveal.js plugin that adds syntax highlight support.
*/
-var t={id:"highlight",HIGHLIGHT_STEP_DELIMITER:"|",HIGHLIGHT_LINE_DELIMITER:",",HIGHLIGHT_LINE_RANGE_DELIMITER:"-",init:function(e){var r=e.getConfig().highlight||{};r.highlightOnLoad="boolean"!=typeof r.highlightOnLoad||r.highlightOnLoad,r.escapeHTML="boolean"!=typeof r.escapeHTML||r.escapeHTML,[].slice.call(document.querySelectorAll(".reveal pre code")).forEach((function(e){e.hasAttribute("data-trim")&&"function"==typeof e.innerHTML.trim&&(e.innerHTML=function(e){function t(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}return function(e){var r=function(e){for(var t=e.split("\n"),r=0;r<t.length&&""===t[r].trim();r++)t.splice(r--,1);for(r=t.length-1;r>=0&&""===t[r].trim();r--)t.splice(r,1);return t.join("\n")}(e.innerHTML).split("\n"),a=r.reduce((function(e,r){return r.length>0&&t(r).length>0&&e>r.length-t(r).length?r.length-t(r).length:e}),Number.POSITIVE_INFINITY);return r.map((function(e,t){return e.slice(a)})).join("\n")}(e)}(e)),r.escapeHTML&&!e.hasAttribute("data-noescape")&&(e.innerHTML=e.innerHTML.replace(/</g,"&lt;").replace(/>/g,"&gt;")),e.addEventListener("focusout",(function(e){hljs.highlightBlock(e.currentTarget)}),!1),r.highlightOnLoad&&t.highlightBlock(e)})),e.on("pdf-ready",(function(){[].slice.call(document.querySelectorAll(".reveal pre code[data-line-numbers].current-fragment")).forEach((function(e){t.scrollHighlightedLineIntoView(e,{},!0)}))}))},highlightBlock:function(e){if(hljs.highlightBlock(e),0!==e.innerHTML.trim().length&&e.hasAttribute("data-line-numbers")){hljs.lineNumbersBlock(e,{singleLine:!0});var r={currentBlock:e},a=t.deserializeHighlightSteps(e.getAttribute("data-line-numbers"));if(a.length>1){var i=parseInt(e.getAttribute("data-fragment-index"),10);("number"!=typeof i||isNaN(i))&&(i=null),a.slice(1).forEach((function(a){var n=e.cloneNode(!0);n.setAttribute("data-line-numbers",t.serializeHighlightSteps([a])),n.classList.add("fragment"),e.parentNode.appendChild(n),t.highlightLines(n),"number"==typeof i?(n.setAttribute("data-fragment-index",i),i+=1):n.removeAttribute("data-fragment-index"),n.addEventListener("visible",t.scrollHighlightedLineIntoView.bind(t,n,r)),n.addEventListener("hidden",t.scrollHighlightedLineIntoView.bind(t,n.previousSibling,r))})),e.removeAttribute("data-fragment-index"),e.setAttribute("data-line-numbers",t.serializeHighlightSteps([a[0]]))}var n="function"==typeof e.closest?e.closest("section:not(.stack)"):null;if(n){n.addEventListener("visible",(function a(){t.scrollHighlightedLineIntoView(e,r,!0),n.removeEventListener("visible",a)}))}t.highlightLines(e)}},scrollHighlightedLineIntoView:function(e,r,a){cancelAnimationFrame(r.animationFrameID),r.currentBlock&&(e.scrollTop=r.currentBlock.scrollTop),r.currentBlock=e;var i=this.getHighlightedLineBounds(e),n=e.offsetHeight,o=getComputedStyle(e);n-=parseInt(o.paddingTop)+parseInt(o.paddingBottom);var s=e.scrollTop,l=i.top+(Math.min(i.bottom-i.top,n)-n)/2,c=e.querySelector(".hljs-ln");if(c&&(l+=c.offsetTop-parseInt(o.paddingTop)),l=Math.max(Math.min(l,e.scrollHeight-n),0),!0===a||s===l)e.scrollTop=l;else{if(e.scrollHeight<=n)return;var _=0;!function a(){_=Math.min(_+.02,1),e.scrollTop=s+(l-s)*t.easeInOutQuart(_),_<1&&(r.animationFrameID=requestAnimationFrame(a))}()}},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},getHighlightedLineBounds:function(e){var t=e.querySelectorAll(".highlight-line");if(0===t.length)return{top:0,bottom:0};var r=t[0],a=t[t.length-1];return{top:r.offsetTop,bottom:a.offsetTop+a.offsetHeight}},highlightLines:function(e,r){var a=t.deserializeHighlightSteps(r||e.getAttribute("data-line-numbers"));a.length&&a[0].forEach((function(t){var r=[];"number"==typeof t.end?r=[].slice.call(e.querySelectorAll("table tr:nth-child(n+"+t.start+"):nth-child(-n+"+t.end+")")):"number"==typeof t.start&&(r=[].slice.call(e.querySelectorAll("table tr:nth-child("+t.start+")"))),r.length&&(r.forEach((function(e){e.classList.add("highlight-line")})),e.classList.add("has-highlights"))}))},deserializeHighlightSteps:function(e){return(e=(e=e.replace(/\s/g,"")).split(t.HIGHLIGHT_STEP_DELIMITER)).map((function(e){return e.split(t.HIGHLIGHT_LINE_DELIMITER).map((function(e){if(/^[\d-]+$/.test(e)){e=e.split(t.HIGHLIGHT_LINE_RANGE_DELIMITER);var r=parseInt(e[0],10),a=parseInt(e[1],10);return isNaN(a)?{start:r}:{start:r,end:a}}return{}}))}))},serializeHighlightSteps:function(e){return e.map((function(e){return e.map((function(e){return"number"==typeof e.end?e.start+t.HIGHLIGHT_LINE_RANGE_DELIMITER+e.end:"number"==typeof e.start?e.start:""})).join(t.HIGHLIGHT_LINE_DELIMITER)})).join(t.HIGHLIGHT_STEP_DELIMITER)}};return function(){return t}}));
+var t={id:"highlight",HIGHLIGHT_STEP_DELIMITER:"|",HIGHLIGHT_LINE_DELIMITER:",",HIGHLIGHT_LINE_RANGE_DELIMITER:"-",init:function(e){var r=e.getConfig().highlight||{};r.highlightOnLoad="boolean"!=typeof r.highlightOnLoad||r.highlightOnLoad,r.escapeHTML="boolean"!=typeof r.escapeHTML||r.escapeHTML,[].slice.call(e.getRevealElement().querySelectorAll("pre code")).forEach((function(e){e.hasAttribute("data-trim")&&"function"==typeof e.innerHTML.trim&&(e.innerHTML=function(e){function t(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}return function(e){var r=function(e){for(var t=e.split("\n"),r=0;r<t.length&&""===t[r].trim();r++)t.splice(r--,1);for(r=t.length-1;r>=0&&""===t[r].trim();r--)t.splice(r,1);return t.join("\n")}(e.innerHTML).split("\n"),a=r.reduce((function(e,r){return r.length>0&&t(r).length>0&&e>r.length-t(r).length?r.length-t(r).length:e}),Number.POSITIVE_INFINITY);return r.map((function(e,t){return e.slice(a)})).join("\n")}(e)}(e)),r.escapeHTML&&!e.hasAttribute("data-noescape")&&(e.innerHTML=e.innerHTML.replace(/</g,"&lt;").replace(/>/g,"&gt;")),e.addEventListener("focusout",(function(e){hljs.highlightBlock(e.currentTarget)}),!1),r.highlightOnLoad&&t.highlightBlock(e)})),e.on("pdf-ready",(function(){[].slice.call(e.getRevealElement().querySelectorAll("pre code[data-line-numbers].current-fragment")).forEach((function(e){t.scrollHighlightedLineIntoView(e,{},!0)}))}))},highlightBlock:function(e){if(hljs.highlightBlock(e),0!==e.innerHTML.trim().length&&e.hasAttribute("data-line-numbers")){hljs.lineNumbersBlock(e,{singleLine:!0});var r={currentBlock:e},a=t.deserializeHighlightSteps(e.getAttribute("data-line-numbers"));if(a.length>1){var i=parseInt(e.getAttribute("data-fragment-index"),10);("number"!=typeof i||isNaN(i))&&(i=null),a.slice(1).forEach((function(a){var n=e.cloneNode(!0);n.setAttribute("data-line-numbers",t.serializeHighlightSteps([a])),n.classList.add("fragment"),e.parentNode.appendChild(n),t.highlightLines(n),"number"==typeof i?(n.setAttribute("data-fragment-index",i),i+=1):n.removeAttribute("data-fragment-index"),n.addEventListener("visible",t.scrollHighlightedLineIntoView.bind(t,n,r)),n.addEventListener("hidden",t.scrollHighlightedLineIntoView.bind(t,n.previousSibling,r))})),e.removeAttribute("data-fragment-index"),e.setAttribute("data-line-numbers",t.serializeHighlightSteps([a[0]]))}var n="function"==typeof e.closest?e.closest("section:not(.stack)"):null;if(n){n.addEventListener("visible",(function a(){t.scrollHighlightedLineIntoView(e,r,!0),n.removeEventListener("visible",a)}))}t.highlightLines(e)}},scrollHighlightedLineIntoView:function(e,r,a){cancelAnimationFrame(r.animationFrameID),r.currentBlock&&(e.scrollTop=r.currentBlock.scrollTop),r.currentBlock=e;var i=this.getHighlightedLineBounds(e),n=e.offsetHeight,o=getComputedStyle(e);n-=parseInt(o.paddingTop)+parseInt(o.paddingBottom);var s=e.scrollTop,l=i.top+(Math.min(i.bottom-i.top,n)-n)/2,c=e.querySelector(".hljs-ln");if(c&&(l+=c.offsetTop-parseInt(o.paddingTop)),l=Math.max(Math.min(l,e.scrollHeight-n),0),!0===a||s===l)e.scrollTop=l;else{if(e.scrollHeight<=n)return;var _=0;!function a(){_=Math.min(_+.02,1),e.scrollTop=s+(l-s)*t.easeInOutQuart(_),_<1&&(r.animationFrameID=requestAnimationFrame(a))}()}},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},getHighlightedLineBounds:function(e){var t=e.querySelectorAll(".highlight-line");if(0===t.length)return{top:0,bottom:0};var r=t[0],a=t[t.length-1];return{top:r.offsetTop,bottom:a.offsetTop+a.offsetHeight}},highlightLines:function(e,r){var a=t.deserializeHighlightSteps(r||e.getAttribute("data-line-numbers"));a.length&&a[0].forEach((function(t){var r=[];"number"==typeof t.end?r=[].slice.call(e.querySelectorAll("table tr:nth-child(n+"+t.start+"):nth-child(-n+"+t.end+")")):"number"==typeof t.start&&(r=[].slice.call(e.querySelectorAll("table tr:nth-child("+t.start+")"))),r.length&&(r.forEach((function(e){e.classList.add("highlight-line")})),e.classList.add("has-highlights"))}))},deserializeHighlightSteps:function(e){return(e=(e=e.replace(/\s/g,"")).split(t.HIGHLIGHT_STEP_DELIMITER)).map((function(e){return e.split(t.HIGHLIGHT_LINE_DELIMITER).map((function(e){if(/^[\d-]+$/.test(e)){e=e.split(t.HIGHLIGHT_LINE_RANGE_DELIMITER);var r=parseInt(e[0],10),a=parseInt(e[1],10);return isNaN(a)?{start:r}:{start:r,end:a}}return{}}))}))},serializeHighlightSteps:function(e){return e.map((function(e){return e.map((function(e){return"number"==typeof e.end?e.start+t.HIGHLIGHT_LINE_RANGE_DELIMITER+e.end:"number"==typeof e.start?e.start:""})).join(t.HIGHLIGHT_LINE_DELIMITER)})).join(t.HIGHLIGHT_STEP_DELIMITER)}};return function(){return t}}));
diff --git a/dist/plugin/markdown.js b/dist/plugin/markdown.js
index ae803ba..2060705 100644
--- a/dist/plugin/markdown.js
+++ b/dist/plugin/markdown.js
@@ -1,6 +1,6 @@
-!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).RevealMarkdown=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}var s=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){function t(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,xhtml:!1}}e.exports={defaults:{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,xhtml:!1},getDefaults:t,changeDefaults:function(t){e.exports.defaults=t}}})),i=(s.defaults,s.getDefaults,s.changeDefaults,/[&<>"']/),a=/[&<>"']/g,l=/[<>"']|&(?!#?\w+;)/,o=/[<>"']|&(?!#?\w+;)/g,c={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},u=function(e){return c[e]};var h=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function p(e){return e.replace(h,(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)):""}))}var g=/(^|[^\[])\^/g;var f=/[^\w:]/g,d=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;var b={},k=/^[^:]+:\/*[^/]*$/,m=/^([^:]+:)[\s\S]*$/,x=/^([^:]+:\/*[^/]*)[\s\S]*$/;function y(e,t){b[" "+e]||(k.test(e)?b[" "+e]=e+"/":b[" "+e]=v(e,"/",!0));var n=-1===(e=b[" "+e]).indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(m,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(x,"$1")+t:e+t}function v(e,t,n){var r=e.length;if(0===r)return"";for(var s=0;s<r;){var i=e.charAt(r-s-1);if(i!==t||n){if(i===t||!n)break;s++}else s++}return e.substr(0,r-s)}var w=function(e,t){if(t){if(i.test(e))return e.replace(a,u)}else if(l.test(e))return e.replace(o,u);return e},_=p,S=function(e,t,n){if(e){var r;try{r=decodeURIComponent(p(n)).replace(f,"").toLowerCase()}catch(e){return null}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return null}t&&!d.test(n)&&(n=y(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(e){return null}return n},A=function(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(e,t){var n=e.replace(/\|/g,(function(e,t,n){for(var r=!1,s=t;--s>=0&&"\\"===n[s];)r=!r;return r?"|":" |"})).split(/ \|/),r=0;if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,"|");return n},R=v,z=function(e,t){if(-1===e.indexOf(t[1]))return-1;for(var n=e.length,r=0,s=0;s<n;s++)if("\\"===e[s])s++;else if(e[s]===t[0])r++;else if(e[s]===t[1]&&--r<0)return s;return-1},T=function(e){e&&e.sanitize&&!e.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")},E={exec:function(){}},L=function(e,t){e=e.source||e,t=t||"";var n={replace:function(t,r){return r=(r=r.source||r).replace(g,"$1"),e=e.replace(t,r),n},getRegex:function(){return new RegExp(e,t)}};return n},q=A,C={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:E,table:E,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};C.def=L(C.def).replace("label",C._label).replace("title",C._title).getRegex(),C.bullet=/(?:[*+-]|\d{1,9}\.)/,C.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,C.item=L(C.item,"gm").replace(/bull/g,C.bullet).getRegex(),C.list=L(C.list).replace(/bull/g,C.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+C.def.source+")").getRegex(),C._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",C._comment=/<!--(?!-?>)[\s\S]*?-->/,C.html=L(C.html,"i").replace("comment",C._comment).replace("tag",C._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),C.paragraph=L(C._paragraph).replace("hr",C.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",C._tag).getRegex(),C.blockquote=L(C.blockquote).replace("paragraph",C.paragraph).getRegex(),C.normal=q({},C),C.gfm=q({},C.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),C.gfm.nptable=L(C.gfm.nptable).replace("hr",C.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",C._tag).getRegex(),C.gfm.table=L(C.gfm.table).replace("hr",C.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",C._tag).getRegex(),C.pedantic=q({},C.normal,{html:L("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",C._comment).replace(/tag/g,"(?!(?: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").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:E,paragraph:L(C.normal._paragraph).replace("hr",C.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",C.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var I={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:E,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,em:/^_([^\s_])_(?!_)|^_([^\s_<][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_<][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s*<\[])\*(?!\*)|^\*([^\s<"][\s\S]*?[^\s\[\*])\*(?![\]`punctuation])|^\*([^\s*"<\[][\s\S]*[^\s])\*(?!\*)/,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:E,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,_punctuation:"!\"#$%&'()*+\\-./:;<=>?@\\[^_{|}~"};I.em=L(I.em).replace(/punctuation/g,I._punctuation).getRegex(),I._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,I._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,I._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])?)+(?![-_])/,I.autolink=L(I.autolink).replace("scheme",I._scheme).replace("email",I._email).getRegex(),I._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,I.tag=L(I.tag).replace("comment",C._comment).replace("attribute",I._attribute).getRegex(),I._label=/(?:\[[^\[\]]*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,I._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,I._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,I.link=L(I.link).replace("label",I._label).replace("href",I._href).replace("title",I._title).getRegex(),I.reflink=L(I.reflink).replace("label",I._label).getRegex(),I.normal=q({},I),I.pedantic=q({},I.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:L(/^!?\[(label)\]\((.*?)\)/).replace("label",I._label).getRegex(),reflink:L(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",I._label).getRegex()}),I.gfm=q({},I.normal,{escape:L(I.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),I.gfm.url=L(I.gfm.url,"i").replace("email",I.gfm._extended_email).getRegex(),I.breaks=q({},I.gfm,{br:L(I.br).replace("{2,}","*").getRegex(),text:L(I.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Z={block:C,inline:I},O=s.defaults,P=Z.block,N=Z.inline,M=R,D=$,j=w,H=z,B=function(){function e(n){t(this,e),this.tokens=[],this.tokens.links=Object.create(null),this.options=n||O,this.rules={block:P.normal,inline:N.normal},this.options.pedantic?(this.rules.block=P.pedantic,this.rules.inline=N.pedantic):this.options.gfm&&(this.rules.block=P.gfm,this.options.breaks?this.rules.inline=N.breaks:this.rules.inline=N.gfm)}return r(e,[{key:"lex",value:function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens),this.inline(this.tokens),this.tokens}},{key:"blockTokens",value:function(e,t){var n,r,s,i,a,l,o,c,u,h,p,g,f,d,b,k,m,x=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];for(e=e.replace(/^ +$/gm,"");e;)if((s=this.rules.block.newline.exec(e))&&(e=e.substring(s[0].length),m=s[0],s[0].length>1&&t.push({type:"space",raw:m})),s=this.rules.block.code.exec(e))b=t[t.length-1],e=e.substring(s[0].length),m=s[0],b&&"paragraph"===b.type?(b.text+="\n"+s[0].trimRight(),b.raw+="\n"+m):(s=s[0].replace(/^ {4}/gm,""),t.push({type:"code",raw:m,codeBlockStyle:"indented",text:this.options.pedantic?s:M(s,"\n")}));else if(s=this.rules.block.fences.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:"code",raw:m,lang:s[2]?s[2].trim():s[2],text:s[3]||""});else if(s=this.rules.block.heading.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:"heading",raw:m,depth:s[1].length,text:s[2]});else if((s=this.rules.block.nptable.exec(e))&&(l={type:"table",header:D(s[1].replace(/^ *| *\| *$/g,"")),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3]?s[3].replace(/\n$/,"").split("\n"):[]}).header.length===l.align.length){for(e=e.substring(s[0].length),m=s[0],l.raw=m,p=l.align.length,u=0;u<p;u++)/^ *-+: *$/.test(l.align[u])?l.align[u]="right":/^ *:-+: *$/.test(l.align[u])?l.align[u]="center":/^ *:-+ *$/.test(l.align[u])?l.align[u]="left":l.align[u]=null;for(p=l.cells.length,u=0;u<p;u++)l.cells[u]=D(l.cells[u],l.header.length);t.push(l)}else if(s=this.rules.block.hr.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:"hr",raw:m});else if(s=this.rules.block.blockquote.exec(e))e=e.substring(s[0].length),m=s[0],s=s[0].replace(/^ *> ?/gm,""),t.push({type:"blockquote",raw:m,tokens:this.blockTokens(s,[],x)});else if(s=this.rules.block.list.exec(e))for(e=e.substring(s[0].length),o={type:"list",raw:m=s[0],ordered:g=(i=s[2]).length>1,start:g?+i:"",loose:!1,items:[]},t.push(o),n=!1,p=(s=s[0].match(this.rules.block.item)).length,u=0;u<p;u++)m=(l=s[u]).trim(),c=l.length,~(l=l.replace(/^ *([*+-]|\d+\.) */,"")).indexOf("\n ")&&(c-=l.length,l=this.options.pedantic?l.replace(/^ {1,4}/gm,""):l.replace(new RegExp("^ {1,"+c+"}","gm"),"")),u!==p-1&&(a=P.bullet.exec(s[u+1])[0],(i.length>1?1===a.length:a.length>1||this.options.smartLists&&a!==i)&&(e=(k=s.slice(u+1).join("\n"))+e,o.raw=o.raw.substring(o.raw.length-k.length),u=p-1)),r=n||/\n\n(?!\s*$)/.test(l),u!==p-1&&(n="\n"===l.charAt(l.length-1),r||(r=n)),r&&(o.loose=!0),d=void 0,(f=/^\[[ xX]\] /.test(l))&&(d=" "!==l[1],l=l.replace(/^\[[ xX]\] +/,"")),o.items.push({raw:m,task:f,checked:d,loose:r,tokens:this.blockTokens(l,[],!1)});else if(s=this.rules.block.html.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:this.options.sanitize?"paragraph":"html",raw:m,pre:!this.options.sanitizer&&("pre"===s[1]||"script"===s[1]||"style"===s[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(s[0]):j(s[0]):s[0]});else if(x&&(s=this.rules.block.def.exec(e)))e=e.substring(s[0].length),s[3]&&(s[3]=s[3].substring(1,s[3].length-1)),h=s[1].toLowerCase().replace(/\s+/g," "),this.tokens.links[h]||(this.tokens.links[h]={href:s[2],title:s[3]});else if((s=this.rules.block.table.exec(e))&&(l={type:"table",header:D(s[1].replace(/^ *| *\| *$/g,"")),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3]?s[3].replace(/\n$/,"").split("\n"):[]}).header.length===l.align.length){for(e=e.substring(s[0].length),l.raw=s[0],p=l.align.length,u=0;u<p;u++)/^ *-+: *$/.test(l.align[u])?l.align[u]="right":/^ *:-+: *$/.test(l.align[u])?l.align[u]="center":/^ *:-+ *$/.test(l.align[u])?l.align[u]="left":l.align[u]=null;for(p=l.cells.length,u=0;u<p;u++)l.cells[u]=D(l.cells[u].replace(/^ *\| *| *\| *$/g,""),l.header.length);t.push(l)}else if(s=this.rules.block.lheading.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:"heading",raw:m,depth:"="===s[2].charAt(0)?1:2,text:s[1]});else if(x&&(s=this.rules.block.paragraph.exec(e)))e=e.substring(s[0].length),m=s[0],t.push({type:"paragraph",raw:m,text:"\n"===s[1].charAt(s[1].length-1)?s[1].slice(0,-1):s[1]});else if(s=this.rules.block.text.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:"text",raw:m,text:s[0]});else if(e){var y="Infinite loop on byte: "+e.charCodeAt(0);if(!this.options.silent)throw new Error(y);console.error(y)}return t}},{key:"inline",value:function(e){var t,n,r,s,i,a,l=e.length;for(t=0;t<l;t++)switch((a=e[t]).type){case"paragraph":case"text":case"heading":a.tokens=[],this.inlineTokens(a.text,a.tokens);break;case"table":for(a.tokens={header:[],cells:[]},s=a.header.length,n=0;n<s;n++)a.tokens.header[n]=[],this.inlineTokens(a.header[n],a.tokens.header[n]);for(s=a.cells.length,n=0;n<s;n++)for(i=a.cells[n],a.tokens.cells[n]=[],r=0;r<i.length;r++)a.tokens.cells[n][r]=[],this.inlineTokens(i[r],a.tokens.cells[n][r]);break;case"blockquote":this.inline(a.tokens);break;case"list":for(s=a.items.length,n=0;n<s;n++)this.inline(a.items[n].tokens)}return e}},{key:"inlineTokens",value:function(e,t){for(var n,r,s,i,a,l,o,c,u,h,p="";e;)if(l=this.rules.inline.escape.exec(e))e=e.substring(l[0].length),h=l[0],p+=r=j(l[1]),t.push({type:"escape",raw:h,text:r});else if(l=this.rules.inline.tag.exec(e))!this.inLink&&/^<a /i.test(l[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(l[0])&&(this.inLink=!1),!this.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(l[0])?this.inRawBlock=!0:this.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(l[0])&&(this.inRawBlock=!1),e=e.substring(l[0].length),h=l[0],r=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(l[0]):j(l[0]):l[0],t.push({type:this.options.sanitize?"text":"html",raw:h,text:r}),p+=r;else if(l=this.rules.inline.link.exec(e))(c=H(l[2],"()"))>-1&&(u=(0===l[0].indexOf("!")?5:4)+l[1].length+c,l[2]=l[2].substring(0,c),l[0]=l[0].substring(0,u).trim(),l[3]=""),e=e.substring(l[0].length),h=l[0],this.inLink=!0,i=l[2],this.options.pedantic?(n=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i))?(i=n[1],a=n[3]):a="":a=l[3]?l[3].slice(1,-1):"",i=i.trim().replace(/^<([\s\S]*)>$/,"$1"),p+=this.outputLink(l,{href:this.escapes(i),title:this.escapes(a)},t,h),this.inLink=!1;else if((l=this.rules.inline.reflink.exec(e))||(l=this.rules.inline.nolink.exec(e))){if(e=e.substring(l[0].length),h=l[0],n=(l[2]||l[1]).replace(/\s+/g," "),!(n=this.tokens.links[n.toLowerCase()])||!n.href){p+=r=l[0].charAt(0),t.push({type:"text",raw:r,text:r}),e=l[0].substring(1)+e;continue}this.inLink=!0,p+=this.outputLink(l,n,t,h),this.inLink=!1}else if(l=this.rules.inline.strong.exec(e))e=e.substring(l[0].length),h=l[0],s=t?[]:null,r=this.inlineTokens(l[4]||l[3]||l[2]||l[1],s),t.push({type:"strong",raw:h,text:r,tokens:s}),p+=r;else if(l=this.rules.inline.em.exec(e))e=e.substring(l[0].length),h=l[0],s=t?[]:null,r=this.inlineTokens(l[6]||l[5]||l[4]||l[3]||l[2]||l[1],s),t.push({type:"em",raw:h,text:r,tokens:s}),p+=r;else if(l=this.rules.inline.code.exec(e))e=e.substring(l[0].length),h=l[0],r=j(l[2].trim(),!0),t.push({type:"codespan",raw:h,text:r}),p+=r;else if(l=this.rules.inline.br.exec(e))e=e.substring(l[0].length),h=l[0],t.push({type:"br",raw:h}),p+="\n";else if(l=this.rules.inline.del.exec(e))e=e.substring(l[0].length),h=l[0],s=t?[]:null,r=this.inlineTokens(l[1],s),t.push({type:"del",raw:h,text:r,tokens:s}),p+=r;else if(l=this.rules.inline.autolink.exec(e))e=e.substring(l[0].length),h=l[0],i="@"===l[2]?"mailto:"+(r=j(this.options.mangle?this.mangle(l[1]):l[1])):r=j(l[1]),t.push({type:"link",raw:h,text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}),p+=r;else if(this.inLink||!(l=this.rules.inline.url.exec(e))){if(l=this.rules.inline.text.exec(e))e=e.substring(l[0].length),h=l[0],r=this.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(l[0]):j(l[0]):l[0]:j(this.options.smartypants?this.smartypants(l[0]):l[0]),t.push({type:"text",raw:h,text:r}),p+=r;else if(e){var g="Infinite loop on byte: "+e.charCodeAt(0);if(!this.options.silent)throw new Error(g);console.error(g)}}else{if("@"===l[2])i="mailto:"+(r=j(this.options.mangle?this.mangle(l[0]):l[0]));else{do{o=l[0],l[0]=this.rules.inline._backpedal.exec(l[0])[0]}while(o!==l[0]);r=j(l[0]),i="www."===l[1]?"http://"+r:r}e=e.substring(l[0].length),h=l[0],t.push({type:"link",raw:h,text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}),p+=r}return p}},{key:"escapes",value:function(e){return e?e.replace(N._escapes,"$1"):e}},{key:"outputLink",value:function(e,t,n,r){var s=t.href,i=t.title?j(t.title):null,a=n?[]:null;if("!"!==e[0].charAt(0)){var l=this.inlineTokens(e[1],a);return n.push({type:"link",raw:r,text:l,href:s,title:i,tokens:a}),l}var o=j(e[1]);return n.push({type:"image",raw:r,text:o,href:s,title:i}),o}},{key:"smartypants",value:function(e){return e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}},{key:"mangle",value:function(e){var t,n,r="",s=e.length;for(t=0;t<s;t++)n=e.charCodeAt(t),Math.random()>.5&&(n="x"+n.toString(16)),r+="&#"+n+";";return r}}],[{key:"lex",value:function(t,n){return new e(n).lex(t)}},{key:"rules",get:function(){return{block:P,inline:N}}}]),e}(),U=s.defaults,F=S,V=w,X=function(){function e(n){t(this,e),this.options=n||U}return r(e,[{key:"code",value:function(e,t,n){var r=(t||"").match(/\S*/)[0];if(this.options.highlight){var s=this.options.highlight(e,r);null!=s&&s!==e&&(n=!0,e=s)}return r?'<pre><code class="'+this.options.langPrefix+V(r,!0)+'">'+(n?e:V(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:V(e,!0))+"</code></pre>"}},{key:"blockquote",value:function(e){return"<blockquote>\n"+e+"</blockquote>\n"}},{key:"html",value:function(e){return e}},{key:"heading",value:function(e,t,n,r){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+r.slug(n)+'">'+e+"</h"+t+">\n":"<h"+t+">"+e+"</h"+t+">\n"}},{key:"hr",value:function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"}},{key:"list",value:function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+r+">\n"}},{key:"listitem",value:function(e){return"<li>"+e+"</li>\n"}},{key:"checkbox",value:function(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "}},{key:"paragraph",value:function(e){return"<p>"+e+"</p>\n"}},{key:"table",value:function(e,t){return t&&(t="<tbody>"+t+"</tbody>"),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}},{key:"tablerow",value:function(e){return"<tr>\n"+e+"</tr>\n"}},{key:"tablecell",value:function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"</"+n+">\n"}},{key:"strong",value:function(e){return"<strong>"+e+"</strong>"}},{key:"em",value:function(e){return"<em>"+e+"</em>"}},{key:"codespan",value:function(e){return"<code>"+e+"</code>"}},{key:"br",value:function(){return this.options.xhtml?"<br/>":"<br>"}},{key:"del",value:function(e){return"<del>"+e+"</del>"}},{key:"link",value:function(e,t,n){if(null===(e=F(this.options.sanitize,this.options.baseUrl,e)))return n;var r='<a href="'+V(e)+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>"}},{key:"image",value:function(e,t,n){if(null===(e=F(this.options.sanitize,this.options.baseUrl,e)))return n;var r='<img src="'+e+'" alt="'+n+'"';return t&&(r+=' title="'+t+'"'),r+=this.options.xhtml?"/>":">"}},{key:"text",value:function(e){return e}}]),e}(),G=function(){function e(){t(this,e)}return r(e,[{key:"strong",value:function(e){return e}},{key:"em",value:function(e){return e}},{key:"codespan",value:function(e){return e}},{key:"del",value:function(e){return e}},{key:"html",value:function(e){return e}},{key:"text",value:function(e){return e}},{key:"link",value:function(e,t,n){return""+n}},{key:"image",value:function(e,t,n){return""+n}},{key:"br",value:function(){return""}}]),e}(),J=function(){function e(){t(this,e),this.seen={}}return r(e,[{key:"slug",value:function(e){var t=e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t)){var n=t;do{this.seen[n]++,t=n+"-"+this.seen[n]}while(this.seen.hasOwnProperty(t))}return this.seen[t]=0,t}}]),e}(),K=s.defaults,Q=_,W=function(){function e(n){t(this,e),this.options=n||K,this.options.renderer=this.options.renderer||new X,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new G,this.slugger=new J}return r(e,[{key:"parse",value:function(e){var t,n,r,s,i,a,l,o,c,u,h,p,g,f,d,b,k,m,x=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],y="",v=e.length;for(t=0;t<v;t++)switch((u=e[t]).type){case"space":continue;case"hr":y+=this.renderer.hr();continue;case"heading":y+=this.renderer.heading(this.parseInline(u.tokens),u.depth,Q(this.parseInline(u.tokens,this.textRenderer)),this.slugger);continue;case"code":y+=this.renderer.code(u.text,u.lang,u.escaped);continue;case"table":for(o="",l="",s=u.header.length,n=0;n<s;n++)l+=this.renderer.tablecell(this.parseInline(u.tokens.header[n]),{header:!0,align:u.align[n]});for(o+=this.renderer.tablerow(l),c="",s=u.cells.length,n=0;n<s;n++){for(l="",i=(a=u.tokens.cells[n]).length,r=0;r<i;r++)l+=this.renderer.tablecell(this.parseInline(a[r]),{header:!1,align:u.align[r]});c+=this.renderer.tablerow(l)}y+=this.renderer.table(o,c);continue;case"blockquote":c=this.parse(u.tokens),y+=this.renderer.blockquote(c);continue;case"list":for(h=u.ordered,p=u.start,g=u.loose,s=u.items.length,c="",n=0;n<s;n++)b=(d=u.items[n]).checked,k=d.task,f="",d.task&&(m=this.renderer.checkbox(b),g?"text"===d.tokens[0].type?(d.tokens[0].text=m+" "+d.tokens[0].text,d.tokens[0].tokens&&d.tokens[0].tokens.length>0&&"text"===d.tokens[0].tokens[0].type&&(d.tokens[0].tokens[0].text=m+" "+d.tokens[0].tokens[0].text)):d.tokens.unshift({type:"text",text:m}):f+=m),f+=this.parse(d.tokens,g),c+=this.renderer.listitem(f,k,b);y+=this.renderer.list(c,h,p);continue;case"html":y+=this.renderer.html(u.text);continue;case"paragraph":y+=this.renderer.paragraph(this.parseInline(u.tokens));continue;case"text":for(c=u.tokens?this.parseInline(u.tokens):u.text;t+1<v&&"text"===e[t+1].type;)c+="\n"+((u=e[++t]).tokens?this.parseInline(u.tokens):u.text);y+=x?this.renderer.paragraph(c):c;continue;default:var w='Token with "'+u.type+'" type was not found.';if(this.options.silent)return void console.error(w);throw new Error(w)}return y}},{key:"parseInline",value:function(e,t){t=t||this.renderer;var n,r,s="",i=e.length;for(n=0;n<i;n++)switch((r=e[n]).type){case"escape":s+=t.text(r.text);break;case"html":s+=t.html(r.text);break;case"link":s+=t.link(r.href,r.title,this.parseInline(r.tokens,t));break;case"image":s+=t.image(r.href,r.title,r.text);break;case"strong":s+=t.strong(this.parseInline(r.tokens,t));break;case"em":s+=t.em(this.parseInline(r.tokens,t));break;case"codespan":s+=t.codespan(r.text);break;case"br":s+=t.br();break;case"del":s+=t.del(this.parseInline(r.tokens,t));break;case"text":s+=t.text(r.text);break;default:var a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return void console.error(a);throw new Error(a)}return s}}],[{key:"parse",value:function(t,n){return new e(n).parse(t)}}]),e}(),Y=A,ee=T,te=w,ne=s.getDefaults,re=s.changeDefaults,se=s.defaults;function ie(t,n,r){if(null==t)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof t)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected");if(r||"function"==typeof n){var s=function(){r||(r=n,n=null),n=Y({},ie.defaults,n||{}),ee(n);var e,s,i=n.highlight,a=0;try{e=B.lex(t,n)}catch(e){return{v:r(e)}}s=e.length;var l=function(t){if(t)return n.highlight=i,r(t);var s;try{s=W.parse(e,n)}catch(e){t=e}return n.highlight=i,t?r(t):r(null,s)};if(!i||i.length<3)return{v:l()};if(delete n.highlight,!s)return{v:l()};for(;a<e.length;a++)!function(e){"code"!==e.type?--s||l():i(e.text,e.lang,(function(t,n){return t?l(t):null==n||n===e.text?--s||l():(e.text=n,e.escaped=!0,void(--s||l()))}))}(e[a]);return{v:void 0}}();if("object"===e(s))return s.v}try{return n=Y({},ie.defaults,n||{}),ee(n),W.parse(B.lex(t,n),n)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",(n||ie.defaults).silent)return"<p>An error occurred:</p><pre>"+te(e.message+"",!0)+"</pre>";throw e}}ie.options=ie.setOptions=function(e){return Y(ie.defaults,e),re(ie.defaults),ie},ie.getDefaults=ne,ie.defaults=se,ie.Parser=W,ie.parser=W.parse,ie.Renderer=X,ie.TextRenderer=G,ie.Lexer=B,ie.lexer=B.lex,ie.Slugger=J,ie.parse=ie;var ae=ie,le={id:"markdown",init:function(e){var t=e.getConfig().markdown;return t&&ae.setOptions(t),ge(e.getRevealElement()).then(de)},processSlides:ge,convertSlides:de,slidify:pe,marked:ae};
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).RevealMarkdown=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}var s=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){function t(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,xhtml:!1}}e.exports={defaults:{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,xhtml:!1},getDefaults:t,changeDefaults:function(t){e.exports.defaults=t}}})),i=(s.defaults,s.getDefaults,s.changeDefaults,/[&<>"']/),a=/[&<>"']/g,l=/[<>"']|&(?!#?\w+;)/,o=/[<>"']|&(?!#?\w+;)/g,c={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},u=function(e){return c[e]};var h=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function p(e){return e.replace(h,(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)):""}))}var g=/(^|[^\[])\^/g;var f=/[^\w:]/g,d=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;var b={},k=/^[^:]+:\/*[^/]*$/,m=/^([^:]+:)[\s\S]*$/,x=/^([^:]+:\/*[^/]*)[\s\S]*$/;function y(e,t){b[" "+e]||(k.test(e)?b[" "+e]=e+"/":b[" "+e]=v(e,"/",!0));var n=-1===(e=b[" "+e]).indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(m,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(x,"$1")+t:e+t}function v(e,t,n){var r=e.length;if(0===r)return"";for(var s=0;s<r;){var i=e.charAt(r-s-1);if(i!==t||n){if(i===t||!n)break;s++}else s++}return e.substr(0,r-s)}var w=function(e,t){if(t){if(i.test(e))return e.replace(a,u)}else if(l.test(e))return e.replace(o,u);return e},_=p,S=function(e,t,n){if(e){var r;try{r=decodeURIComponent(p(n)).replace(f,"").toLowerCase()}catch(e){return null}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return null}t&&!d.test(n)&&(n=y(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(e){return null}return n},A=function(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(e,t){var n=e.replace(/\|/g,(function(e,t,n){for(var r=!1,s=t;--s>=0&&"\\"===n[s];)r=!r;return r?"|":" |"})).split(/ \|/),r=0;if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,"|");return n},R=v,z=function(e,t){if(-1===e.indexOf(t[1]))return-1;for(var n=e.length,r=0,s=0;s<n;s++)if("\\"===e[s])s++;else if(e[s]===t[0])r++;else if(e[s]===t[1]&&--r<0)return s;return-1},T=function(e){e&&e.sanitize&&!e.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")},E={exec:function(){}},L=function(e,t){e=e.source||e,t=t||"";var n={replace:function(t,r){return r=(r=r.source||r).replace(g,"$1"),e=e.replace(t,r),n},getRegex:function(){return new RegExp(e,t)}};return n},q=A,C={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:E,table:E,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};C.def=L(C.def).replace("label",C._label).replace("title",C._title).getRegex(),C.bullet=/(?:[*+-]|\d{1,9}\.)/,C.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,C.item=L(C.item,"gm").replace(/bull/g,C.bullet).getRegex(),C.list=L(C.list).replace(/bull/g,C.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+C.def.source+")").getRegex(),C._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",C._comment=/<!--(?!-?>)[\s\S]*?-->/,C.html=L(C.html,"i").replace("comment",C._comment).replace("tag",C._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),C.paragraph=L(C._paragraph).replace("hr",C.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",C._tag).getRegex(),C.blockquote=L(C.blockquote).replace("paragraph",C.paragraph).getRegex(),C.normal=q({},C),C.gfm=q({},C.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),C.gfm.nptable=L(C.gfm.nptable).replace("hr",C.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",C._tag).getRegex(),C.gfm.table=L(C.gfm.table).replace("hr",C.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",C._tag).getRegex(),C.pedantic=q({},C.normal,{html:L("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",C._comment).replace(/tag/g,"(?!(?: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").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:E,paragraph:L(C.normal._paragraph).replace("hr",C.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",C.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var I={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:E,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,em:/^_([^\s_])_(?!_)|^_([^\s_<][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_<][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s*<\[])\*(?!\*)|^\*([^\s<"][\s\S]*?[^\s\[\*])\*(?![\]`punctuation])|^\*([^\s*"<\[][\s\S]*[^\s])\*(?!\*)/,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:E,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,_punctuation:"!\"#$%&'()*+\\-./:;<=>?@\\[^_{|}~"};I.em=L(I.em).replace(/punctuation/g,I._punctuation).getRegex(),I._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,I._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,I._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])?)+(?![-_])/,I.autolink=L(I.autolink).replace("scheme",I._scheme).replace("email",I._email).getRegex(),I._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,I.tag=L(I.tag).replace("comment",C._comment).replace("attribute",I._attribute).getRegex(),I._label=/(?:\[[^\[\]]*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,I._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,I._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,I.link=L(I.link).replace("label",I._label).replace("href",I._href).replace("title",I._title).getRegex(),I.reflink=L(I.reflink).replace("label",I._label).getRegex(),I.normal=q({},I),I.pedantic=q({},I.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:L(/^!?\[(label)\]\((.*?)\)/).replace("label",I._label).getRegex(),reflink:L(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",I._label).getRegex()}),I.gfm=q({},I.normal,{escape:L(I.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),I.gfm.url=L(I.gfm.url,"i").replace("email",I.gfm._extended_email).getRegex(),I.breaks=q({},I.gfm,{br:L(I.br).replace("{2,}","*").getRegex(),text:L(I.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Z={block:C,inline:I},O=s.defaults,P=Z.block,N=Z.inline,M=R,D=$,j=w,H=z,B=function(){function e(n){t(this,e),this.tokens=[],this.tokens.links=Object.create(null),this.options=n||O,this.rules={block:P.normal,inline:N.normal},this.options.pedantic?(this.rules.block=P.pedantic,this.rules.inline=N.pedantic):this.options.gfm&&(this.rules.block=P.gfm,this.options.breaks?this.rules.inline=N.breaks:this.rules.inline=N.gfm)}return r(e,[{key:"lex",value:function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens),this.inline(this.tokens),this.tokens}},{key:"blockTokens",value:function(e,t){var n,r,s,i,a,l,o,c,u,h,p,g,f,d,b,k,m,x=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];for(e=e.replace(/^ +$/gm,"");e;)if((s=this.rules.block.newline.exec(e))&&(e=e.substring(s[0].length),m=s[0],s[0].length>1&&t.push({type:"space",raw:m})),s=this.rules.block.code.exec(e))b=t[t.length-1],e=e.substring(s[0].length),m=s[0],b&&"paragraph"===b.type?(b.text+="\n"+s[0].trimRight(),b.raw+="\n"+m):(s=s[0].replace(/^ {4}/gm,""),t.push({type:"code",raw:m,codeBlockStyle:"indented",text:this.options.pedantic?s:M(s,"\n")}));else if(s=this.rules.block.fences.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:"code",raw:m,lang:s[2]?s[2].trim():s[2],text:s[3]||""});else if(s=this.rules.block.heading.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:"heading",raw:m,depth:s[1].length,text:s[2]});else if((s=this.rules.block.nptable.exec(e))&&(l={type:"table",header:D(s[1].replace(/^ *| *\| *$/g,"")),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3]?s[3].replace(/\n$/,"").split("\n"):[]}).header.length===l.align.length){for(e=e.substring(s[0].length),m=s[0],l.raw=m,p=l.align.length,u=0;u<p;u++)/^ *-+: *$/.test(l.align[u])?l.align[u]="right":/^ *:-+: *$/.test(l.align[u])?l.align[u]="center":/^ *:-+ *$/.test(l.align[u])?l.align[u]="left":l.align[u]=null;for(p=l.cells.length,u=0;u<p;u++)l.cells[u]=D(l.cells[u],l.header.length);t.push(l)}else if(s=this.rules.block.hr.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:"hr",raw:m});else if(s=this.rules.block.blockquote.exec(e))e=e.substring(s[0].length),m=s[0],s=s[0].replace(/^ *> ?/gm,""),t.push({type:"blockquote",raw:m,tokens:this.blockTokens(s,[],x)});else if(s=this.rules.block.list.exec(e))for(e=e.substring(s[0].length),o={type:"list",raw:m=s[0],ordered:g=(i=s[2]).length>1,start:g?+i:"",loose:!1,items:[]},t.push(o),n=!1,p=(s=s[0].match(this.rules.block.item)).length,u=0;u<p;u++)m=(l=s[u]).trim(),c=l.length,~(l=l.replace(/^ *([*+-]|\d+\.) */,"")).indexOf("\n ")&&(c-=l.length,l=this.options.pedantic?l.replace(/^ {1,4}/gm,""):l.replace(new RegExp("^ {1,"+c+"}","gm"),"")),u!==p-1&&(a=P.bullet.exec(s[u+1])[0],(i.length>1?1===a.length:a.length>1||this.options.smartLists&&a!==i)&&(e=(k=s.slice(u+1).join("\n"))+e,o.raw=o.raw.substring(o.raw.length-k.length),u=p-1)),r=n||/\n\n(?!\s*$)/.test(l),u!==p-1&&(n="\n"===l.charAt(l.length-1),r||(r=n)),r&&(o.loose=!0),d=void 0,(f=/^\[[ xX]\] /.test(l))&&(d=" "!==l[1],l=l.replace(/^\[[ xX]\] +/,"")),o.items.push({raw:m,task:f,checked:d,loose:r,tokens:this.blockTokens(l,[],!1)});else if(s=this.rules.block.html.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:this.options.sanitize?"paragraph":"html",raw:m,pre:!this.options.sanitizer&&("pre"===s[1]||"script"===s[1]||"style"===s[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(s[0]):j(s[0]):s[0]});else if(x&&(s=this.rules.block.def.exec(e)))e=e.substring(s[0].length),s[3]&&(s[3]=s[3].substring(1,s[3].length-1)),h=s[1].toLowerCase().replace(/\s+/g," "),this.tokens.links[h]||(this.tokens.links[h]={href:s[2],title:s[3]});else if((s=this.rules.block.table.exec(e))&&(l={type:"table",header:D(s[1].replace(/^ *| *\| *$/g,"")),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3]?s[3].replace(/\n$/,"").split("\n"):[]}).header.length===l.align.length){for(e=e.substring(s[0].length),l.raw=s[0],p=l.align.length,u=0;u<p;u++)/^ *-+: *$/.test(l.align[u])?l.align[u]="right":/^ *:-+: *$/.test(l.align[u])?l.align[u]="center":/^ *:-+ *$/.test(l.align[u])?l.align[u]="left":l.align[u]=null;for(p=l.cells.length,u=0;u<p;u++)l.cells[u]=D(l.cells[u].replace(/^ *\| *| *\| *$/g,""),l.header.length);t.push(l)}else if(s=this.rules.block.lheading.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:"heading",raw:m,depth:"="===s[2].charAt(0)?1:2,text:s[1]});else if(x&&(s=this.rules.block.paragraph.exec(e)))e=e.substring(s[0].length),m=s[0],t.push({type:"paragraph",raw:m,text:"\n"===s[1].charAt(s[1].length-1)?s[1].slice(0,-1):s[1]});else if(s=this.rules.block.text.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:"text",raw:m,text:s[0]});else if(e){var y="Infinite loop on byte: "+e.charCodeAt(0);if(!this.options.silent)throw new Error(y);console.error(y)}return t}},{key:"inline",value:function(e){var t,n,r,s,i,a,l=e.length;for(t=0;t<l;t++)switch((a=e[t]).type){case"paragraph":case"text":case"heading":a.tokens=[],this.inlineTokens(a.text,a.tokens);break;case"table":for(a.tokens={header:[],cells:[]},s=a.header.length,n=0;n<s;n++)a.tokens.header[n]=[],this.inlineTokens(a.header[n],a.tokens.header[n]);for(s=a.cells.length,n=0;n<s;n++)for(i=a.cells[n],a.tokens.cells[n]=[],r=0;r<i.length;r++)a.tokens.cells[n][r]=[],this.inlineTokens(i[r],a.tokens.cells[n][r]);break;case"blockquote":this.inline(a.tokens);break;case"list":for(s=a.items.length,n=0;n<s;n++)this.inline(a.items[n].tokens)}return e}},{key:"inlineTokens",value:function(e,t){for(var n,r,s,i,a,l,o,c,u,h,p="";e;)if(l=this.rules.inline.escape.exec(e))e=e.substring(l[0].length),h=l[0],p+=r=j(l[1]),t.push({type:"escape",raw:h,text:r});else if(l=this.rules.inline.tag.exec(e))!this.inLink&&/^<a /i.test(l[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(l[0])&&(this.inLink=!1),!this.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(l[0])?this.inRawBlock=!0:this.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(l[0])&&(this.inRawBlock=!1),e=e.substring(l[0].length),h=l[0],r=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(l[0]):j(l[0]):l[0],t.push({type:this.options.sanitize?"text":"html",raw:h,text:r}),p+=r;else if(l=this.rules.inline.link.exec(e))(c=H(l[2],"()"))>-1&&(u=(0===l[0].indexOf("!")?5:4)+l[1].length+c,l[2]=l[2].substring(0,c),l[0]=l[0].substring(0,u).trim(),l[3]=""),e=e.substring(l[0].length),h=l[0],this.inLink=!0,i=l[2],this.options.pedantic?(n=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i))?(i=n[1],a=n[3]):a="":a=l[3]?l[3].slice(1,-1):"",i=i.trim().replace(/^<([\s\S]*)>$/,"$1"),p+=this.outputLink(l,{href:this.escapes(i),title:this.escapes(a)},t,h),this.inLink=!1;else if((l=this.rules.inline.reflink.exec(e))||(l=this.rules.inline.nolink.exec(e))){if(e=e.substring(l[0].length),h=l[0],n=(l[2]||l[1]).replace(/\s+/g," "),!(n=this.tokens.links[n.toLowerCase()])||!n.href){p+=r=l[0].charAt(0),t.push({type:"text",raw:r,text:r}),e=l[0].substring(1)+e;continue}this.inLink=!0,p+=this.outputLink(l,n,t,h),this.inLink=!1}else if(l=this.rules.inline.strong.exec(e))e=e.substring(l[0].length),h=l[0],s=t?[]:null,r=this.inlineTokens(l[4]||l[3]||l[2]||l[1],s),t.push({type:"strong",raw:h,text:r,tokens:s}),p+=r;else if(l=this.rules.inline.em.exec(e))e=e.substring(l[0].length),h=l[0],s=t?[]:null,r=this.inlineTokens(l[6]||l[5]||l[4]||l[3]||l[2]||l[1],s),t.push({type:"em",raw:h,text:r,tokens:s}),p+=r;else if(l=this.rules.inline.code.exec(e))e=e.substring(l[0].length),h=l[0],r=j(l[2].trim(),!0),t.push({type:"codespan",raw:h,text:r}),p+=r;else if(l=this.rules.inline.br.exec(e))e=e.substring(l[0].length),h=l[0],t.push({type:"br",raw:h}),p+="\n";else if(l=this.rules.inline.del.exec(e))e=e.substring(l[0].length),h=l[0],s=t?[]:null,r=this.inlineTokens(l[1],s),t.push({type:"del",raw:h,text:r,tokens:s}),p+=r;else if(l=this.rules.inline.autolink.exec(e))e=e.substring(l[0].length),h=l[0],i="@"===l[2]?"mailto:"+(r=j(this.options.mangle?this.mangle(l[1]):l[1])):r=j(l[1]),t.push({type:"link",raw:h,text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}),p+=r;else if(this.inLink||!(l=this.rules.inline.url.exec(e))){if(l=this.rules.inline.text.exec(e))e=e.substring(l[0].length),h=l[0],r=this.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(l[0]):j(l[0]):l[0]:j(this.options.smartypants?this.smartypants(l[0]):l[0]),t.push({type:"text",raw:h,text:r}),p+=r;else if(e){var g="Infinite loop on byte: "+e.charCodeAt(0);if(!this.options.silent)throw new Error(g);console.error(g)}}else{if("@"===l[2])i="mailto:"+(r=j(this.options.mangle?this.mangle(l[0]):l[0]));else{do{o=l[0],l[0]=this.rules.inline._backpedal.exec(l[0])[0]}while(o!==l[0]);r=j(l[0]),i="www."===l[1]?"http://"+r:r}e=e.substring(l[0].length),h=l[0],t.push({type:"link",raw:h,text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}),p+=r}return p}},{key:"escapes",value:function(e){return e?e.replace(N._escapes,"$1"):e}},{key:"outputLink",value:function(e,t,n,r){var s=t.href,i=t.title?j(t.title):null,a=n?[]:null;if("!"!==e[0].charAt(0)){var l=this.inlineTokens(e[1],a);return n.push({type:"link",raw:r,text:l,href:s,title:i,tokens:a}),l}var o=j(e[1]);return n.push({type:"image",raw:r,text:o,href:s,title:i}),o}},{key:"smartypants",value:function(e){return e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}},{key:"mangle",value:function(e){var t,n,r="",s=e.length;for(t=0;t<s;t++)n=e.charCodeAt(t),Math.random()>.5&&(n="x"+n.toString(16)),r+="&#"+n+";";return r}}],[{key:"lex",value:function(t,n){return new e(n).lex(t)}},{key:"rules",get:function(){return{block:P,inline:N}}}]),e}(),U=s.defaults,F=S,V=w,X=function(){function e(n){t(this,e),this.options=n||U}return r(e,[{key:"code",value:function(e,t,n){var r=(t||"").match(/\S*/)[0];if(this.options.highlight){var s=this.options.highlight(e,r);null!=s&&s!==e&&(n=!0,e=s)}return r?'<pre><code class="'+this.options.langPrefix+V(r,!0)+'">'+(n?e:V(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:V(e,!0))+"</code></pre>"}},{key:"blockquote",value:function(e){return"<blockquote>\n"+e+"</blockquote>\n"}},{key:"html",value:function(e){return e}},{key:"heading",value:function(e,t,n,r){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+r.slug(n)+'">'+e+"</h"+t+">\n":"<h"+t+">"+e+"</h"+t+">\n"}},{key:"hr",value:function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"}},{key:"list",value:function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+r+">\n"}},{key:"listitem",value:function(e){return"<li>"+e+"</li>\n"}},{key:"checkbox",value:function(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "}},{key:"paragraph",value:function(e){return"<p>"+e+"</p>\n"}},{key:"table",value:function(e,t){return t&&(t="<tbody>"+t+"</tbody>"),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}},{key:"tablerow",value:function(e){return"<tr>\n"+e+"</tr>\n"}},{key:"tablecell",value:function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"</"+n+">\n"}},{key:"strong",value:function(e){return"<strong>"+e+"</strong>"}},{key:"em",value:function(e){return"<em>"+e+"</em>"}},{key:"codespan",value:function(e){return"<code>"+e+"</code>"}},{key:"br",value:function(){return this.options.xhtml?"<br/>":"<br>"}},{key:"del",value:function(e){return"<del>"+e+"</del>"}},{key:"link",value:function(e,t,n){if(null===(e=F(this.options.sanitize,this.options.baseUrl,e)))return n;var r='<a href="'+V(e)+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>"}},{key:"image",value:function(e,t,n){if(null===(e=F(this.options.sanitize,this.options.baseUrl,e)))return n;var r='<img src="'+e+'" alt="'+n+'"';return t&&(r+=' title="'+t+'"'),r+=this.options.xhtml?"/>":">"}},{key:"text",value:function(e){return e}}]),e}(),G=function(){function e(){t(this,e)}return r(e,[{key:"strong",value:function(e){return e}},{key:"em",value:function(e){return e}},{key:"codespan",value:function(e){return e}},{key:"del",value:function(e){return e}},{key:"html",value:function(e){return e}},{key:"text",value:function(e){return e}},{key:"link",value:function(e,t,n){return""+n}},{key:"image",value:function(e,t,n){return""+n}},{key:"br",value:function(){return""}}]),e}(),J=function(){function e(){t(this,e),this.seen={}}return r(e,[{key:"slug",value:function(e){var t=e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t)){var n=t;do{this.seen[n]++,t=n+"-"+this.seen[n]}while(this.seen.hasOwnProperty(t))}return this.seen[t]=0,t}}]),e}(),K=s.defaults,Q=_,W=function(){function e(n){t(this,e),this.options=n||K,this.options.renderer=this.options.renderer||new X,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new G,this.slugger=new J}return r(e,[{key:"parse",value:function(e){var t,n,r,s,i,a,l,o,c,u,h,p,g,f,d,b,k,m,x=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],y="",v=e.length;for(t=0;t<v;t++)switch((u=e[t]).type){case"space":continue;case"hr":y+=this.renderer.hr();continue;case"heading":y+=this.renderer.heading(this.parseInline(u.tokens),u.depth,Q(this.parseInline(u.tokens,this.textRenderer)),this.slugger);continue;case"code":y+=this.renderer.code(u.text,u.lang,u.escaped);continue;case"table":for(o="",l="",s=u.header.length,n=0;n<s;n++)l+=this.renderer.tablecell(this.parseInline(u.tokens.header[n]),{header:!0,align:u.align[n]});for(o+=this.renderer.tablerow(l),c="",s=u.cells.length,n=0;n<s;n++){for(l="",i=(a=u.tokens.cells[n]).length,r=0;r<i;r++)l+=this.renderer.tablecell(this.parseInline(a[r]),{header:!1,align:u.align[r]});c+=this.renderer.tablerow(l)}y+=this.renderer.table(o,c);continue;case"blockquote":c=this.parse(u.tokens),y+=this.renderer.blockquote(c);continue;case"list":for(h=u.ordered,p=u.start,g=u.loose,s=u.items.length,c="",n=0;n<s;n++)b=(d=u.items[n]).checked,k=d.task,f="",d.task&&(m=this.renderer.checkbox(b),g?"text"===d.tokens[0].type?(d.tokens[0].text=m+" "+d.tokens[0].text,d.tokens[0].tokens&&d.tokens[0].tokens.length>0&&"text"===d.tokens[0].tokens[0].type&&(d.tokens[0].tokens[0].text=m+" "+d.tokens[0].tokens[0].text)):d.tokens.unshift({type:"text",text:m}):f+=m),f+=this.parse(d.tokens,g),c+=this.renderer.listitem(f,k,b);y+=this.renderer.list(c,h,p);continue;case"html":y+=this.renderer.html(u.text);continue;case"paragraph":y+=this.renderer.paragraph(this.parseInline(u.tokens));continue;case"text":for(c=u.tokens?this.parseInline(u.tokens):u.text;t+1<v&&"text"===e[t+1].type;)c+="\n"+((u=e[++t]).tokens?this.parseInline(u.tokens):u.text);y+=x?this.renderer.paragraph(c):c;continue;default:var w='Token with "'+u.type+'" type was not found.';if(this.options.silent)return void console.error(w);throw new Error(w)}return y}},{key:"parseInline",value:function(e,t){t=t||this.renderer;var n,r,s="",i=e.length;for(n=0;n<i;n++)switch((r=e[n]).type){case"escape":s+=t.text(r.text);break;case"html":s+=t.html(r.text);break;case"link":s+=t.link(r.href,r.title,this.parseInline(r.tokens,t));break;case"image":s+=t.image(r.href,r.title,r.text);break;case"strong":s+=t.strong(this.parseInline(r.tokens,t));break;case"em":s+=t.em(this.parseInline(r.tokens,t));break;case"codespan":s+=t.codespan(r.text);break;case"br":s+=t.br();break;case"del":s+=t.del(this.parseInline(r.tokens,t));break;case"text":s+=t.text(r.text);break;default:var a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return void console.error(a);throw new Error(a)}return s}}],[{key:"parse",value:function(t,n){return new e(n).parse(t)}}]),e}(),Y=A,ee=T,te=w,ne=s.getDefaults,re=s.changeDefaults,se=s.defaults;function ie(t,n,r){if(null==t)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof t)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected");if(r||"function"==typeof n){var s=function(){r||(r=n,n=null),n=Y({},ie.defaults,n||{}),ee(n);var e,s,i=n.highlight,a=0;try{e=B.lex(t,n)}catch(e){return{v:r(e)}}s=e.length;var l=function(t){if(t)return n.highlight=i,r(t);var s;try{s=W.parse(e,n)}catch(e){t=e}return n.highlight=i,t?r(t):r(null,s)};if(!i||i.length<3)return{v:l()};if(delete n.highlight,!s)return{v:l()};for(;a<e.length;a++)!function(e){"code"!==e.type?--s||l():i(e.text,e.lang,(function(t,n){return t?l(t):null==n||n===e.text?--s||l():(e.text=n,e.escaped=!0,void(--s||l()))}))}(e[a]);return{v:void 0}}();if("object"===e(s))return s.v}try{return n=Y({},ie.defaults,n||{}),ee(n),W.parse(B.lex(t,n),n)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",(n||ie.defaults).silent)return"<p>An error occurred:</p><pre>"+te(e.message+"",!0)+"</pre>";throw e}}ie.options=ie.setOptions=function(e){return Y(ie.defaults,e),re(ie.defaults),ie},ie.getDefaults=ne,ie.defaults=se,ie.Parser=W,ie.parser=W.parse,ie.Renderer=X,ie.TextRenderer=G,ie.Lexer=B,ie.lexer=B.lex,ie.Slugger=J,ie.parse=ie;var ae=ie;
/*!
* The reveal.js markdown plugin. Handles parsing of
* markdown inside of presentations as well as loading
* of external markdown documents.
- */function oe(e){var t=(e.querySelector("[data-template]")||e.querySelector("script")||e).textContent,n=(t=t.replace(new RegExp("__SCRIPT_END__","g"),"<\/script>")).match(/^\n?(\s*)/)[1].length,r=t.match(/^\n?(\t*)/)[1].length;return r>0?t=t.replace(new RegExp("\\n?\\t{"+r+"}","g"),"\n"):n>1&&(t=t.replace(new RegExp("\\n? {"+n+"}","g"),"\n")),t}function ce(e){for(var t=e.attributes,n=[],r=0,s=t.length;r<s;r++){var i=t[r].name,a=t[r].value;/data\-(markdown|separator|vertical|notes)/gi.test(i)||(a?n.push(i+'="'+a+'"'):n.push(i))}return n.join(" ")}function ue(e){return(e=e||{}).separator=e.separator||"^\r?\n---\r?\n$",e.notesSeparator=e.notesSeparator||"notes?:",e.attributes=e.attributes||"",e}function he(e,t){t=ue(t);var n=e.split(new RegExp(t.notesSeparator,"mgi"));return 2===n.length&&(e=n[0]+'<aside class="notes">'+ae(n[1].trim())+"</aside>"),'<script type="text/template">'+(e=e.replace(/<\/script>/g,"__SCRIPT_END__"))+"<\/script>"}function pe(e,t){t=ue(t);for(var n,r,s,i=new RegExp(t.separator+(t.verticalSeparator?"|"+t.verticalSeparator:""),"mg"),a=new RegExp(t.separator),l=0,o=!0,c=[];n=i.exec(e);)!(r=a.test(n[0]))&&o&&c.push([]),s=e.substring(l,n.index),r&&o?c.push(s):c[c.length-1].push(s),l=i.lastIndex,o=r;(o?c:c[c.length-1]).push(e.substring(l));for(var u="",h=0,p=c.length;h<p;h++)c[h]instanceof Array?(u+="<section "+t.attributes+">",c[h].forEach((function(e){u+="<section data-markdown>"+he(e,t)+"</section>"})),u+="</section>"):u+="<section "+t.attributes+" data-markdown>"+he(c[h],t)+"</section>";return u}function ge(e){return new Promise((function(t){var n=[];[].slice.call(e.querySelectorAll("[data-markdown]:not([data-markdown-parsed])")).forEach((function(e,t){e.getAttribute("data-markdown").length?n.push(function(e){return new Promise((function(t,n){var r=new XMLHttpRequest,s=e.getAttribute("data-markdown"),i=e.getAttribute("data-charset");null!=i&&""!=i&&r.overrideMimeType("text/html; charset="+i),r.onreadystatechange=function(e,r){4===r.readyState&&(r.status>=200&&r.status<300||0===r.status?t(r,s):n(r,s))}.bind(this,e,r),r.open("GET",s,!0);try{r.send()}catch(e){console.warn("Failed to get the Markdown file "+s+". Make sure that the presentation and the file are served by a HTTP server and the file can be found there. "+e),t(r,s)}}))}(e).then((function(t,n){e.outerHTML=pe(t.responseText,{separator:e.getAttribute("data-separator"),verticalSeparator:e.getAttribute("data-separator-vertical"),notesSeparator:e.getAttribute("data-separator-notes"),attributes:ce(e)})}),(function(t,n){e.outerHTML='<section data-state="alert">ERROR: The attempt to fetch '+n+" failed with HTTP status "+t.status+".Check your browser's JavaScript console for more details.<p>Remember that you need to serve the presentation HTML from a HTTP server.</p></section>"}))):e.getAttribute("data-separator")||e.getAttribute("data-separator-vertical")||e.getAttribute("data-separator-notes")?e.outerHTML=pe(oe(e),{separator:e.getAttribute("data-separator"),verticalSeparator:e.getAttribute("data-separator-vertical"),notesSeparator:e.getAttribute("data-separator-notes"),attributes:ce(e)}):e.innerHTML=he(oe(e))})),Promise.all(n).then(t)}))}function fe(e,t,n){var r,s,i=new RegExp(n,"mg"),a=new RegExp('([^"= ]+?)="([^"]+?)"|(data-[^"= ]+?)(?=[" ])',"mg"),l=e.nodeValue;if(r=i.exec(l)){var o=r[1];for(l=l.substring(0,r.index)+l.substring(i.lastIndex),e.nodeValue=l;s=a.exec(o);)s[2]?t.setAttribute(s[1],s[2]):t.setAttribute(s[3],"");return!0}return!1}function de(){var e=document.querySelectorAll("[data-markdown]:not([data-markdown-parsed])");return[].slice.call(e).forEach((function(e){e.setAttribute("data-markdown-parsed",!0);var t=e.querySelector("aside.notes"),n=oe(e);e.innerHTML=ae(n),function e(t,n,r,s,i){if(null!=n&&null!=n.childNodes&&n.childNodes.length>0)for(var a=n,l=0;l<n.childNodes.length;l++){var o=n.childNodes[l];if(l>0)for(var c=l-1;c>=0;){var u=n.childNodes[c];if("function"==typeof u.setAttribute&&"BR"!=u.tagName){a=u;break}c-=1}var h=t;"section"==o.nodeName&&(h=o,a=o),"function"!=typeof o.setAttribute&&o.nodeType!=Node.COMMENT_NODE||e(h,o,a,s,i)}n.nodeType==Node.COMMENT_NODE&&0==fe(n,r,s)&&fe(n,t,i)}(e,e,null,e.getAttribute("data-element-attributes")||e.parentNode.getAttribute("data-element-attributes")||"\\.element\\s*?(.+?)$",e.getAttribute("data-attributes")||e.parentNode.getAttribute("data-attributes")||"\\.slide:\\s*?(\\S.+?)$"),t&&e.appendChild(t)})),Promise.resolve()}return function(){return le}}));
+ */return function(){var e;function t(e){var t=(e.querySelector("[data-template]")||e.querySelector("script")||e).textContent,n=(t=t.replace(new RegExp("__SCRIPT_END__","g"),"<\/script>")).match(/^\n?(\s*)/)[1].length,r=t.match(/^\n?(\t*)/)[1].length;return r>0?t=t.replace(new RegExp("\\n?\\t{"+r+"}","g"),"\n"):n>1&&(t=t.replace(new RegExp("\\n? {"+n+"}","g"),"\n")),t}function n(e){for(var t=e.attributes,n=[],r=0,s=t.length;r<s;r++){var i=t[r].name,a=t[r].value;/data\-(markdown|separator|vertical|notes)/gi.test(i)||(a?n.push(i+'="'+a+'"'):n.push(i))}return n.join(" ")}function r(e){return(e=e||{}).separator=e.separator||"^\r?\n---\r?\n$",e.notesSeparator=e.notesSeparator||"notes?:",e.attributes=e.attributes||"",e}function s(e,t){t=r(t);var n=e.split(new RegExp(t.notesSeparator,"mgi"));return 2===n.length&&(e=n[0]+'<aside class="notes">'+ae(n[1].trim())+"</aside>"),'<script type="text/template">'+(e=e.replace(/<\/script>/g,"__SCRIPT_END__"))+"<\/script>"}function i(e,t){t=r(t);for(var n,i,a,l=new RegExp(t.separator+(t.verticalSeparator?"|"+t.verticalSeparator:""),"mg"),o=new RegExp(t.separator),c=0,u=!0,h=[];n=l.exec(e);)!(i=o.test(n[0]))&&u&&h.push([]),a=e.substring(c,n.index),i&&u?h.push(a):h[h.length-1].push(a),c=l.lastIndex,u=i;(u?h:h[h.length-1]).push(e.substring(c));for(var p="",g=0,f=h.length;g<f;g++)h[g]instanceof Array?(p+="<section "+t.attributes+">",h[g].forEach((function(e){p+="<section data-markdown>"+s(e,t)+"</section>"})),p+="</section>"):p+="<section "+t.attributes+" data-markdown>"+s(h[g],t)+"</section>";return p}function a(e){return new Promise((function(r){var a=[];[].slice.call(e.querySelectorAll("[data-markdown]:not([data-markdown-parsed])")).forEach((function(e,r){e.getAttribute("data-markdown").length?a.push(function(e){return new Promise((function(t,n){var r=new XMLHttpRequest,s=e.getAttribute("data-markdown"),i=e.getAttribute("data-charset");null!=i&&""!=i&&r.overrideMimeType("text/html; charset="+i),r.onreadystatechange=function(e,r){4===r.readyState&&(r.status>=200&&r.status<300||0===r.status?t(r,s):n(r,s))}.bind(this,e,r),r.open("GET",s,!0);try{r.send()}catch(e){console.warn("Failed to get the Markdown file "+s+". Make sure that the presentation and the file are served by a HTTP server and the file can be found there. "+e),t(r,s)}}))}(e).then((function(t,r){e.outerHTML=i(t.responseText,{separator:e.getAttribute("data-separator"),verticalSeparator:e.getAttribute("data-separator-vertical"),notesSeparator:e.getAttribute("data-separator-notes"),attributes:n(e)})}),(function(t,n){e.outerHTML='<section data-state="alert">ERROR: The attempt to fetch '+n+" failed with HTTP status "+t.status+".Check your browser's JavaScript console for more details.<p>Remember that you need to serve the presentation HTML from a HTTP server.</p></section>"}))):e.getAttribute("data-separator")||e.getAttribute("data-separator-vertical")||e.getAttribute("data-separator-notes")?e.outerHTML=i(t(e),{separator:e.getAttribute("data-separator"),verticalSeparator:e.getAttribute("data-separator-vertical"),notesSeparator:e.getAttribute("data-separator-notes"),attributes:n(e)}):e.innerHTML=s(t(e))})),Promise.all(a).then(r)}))}function l(e,t,n){var r,s,i=new RegExp(n,"mg"),a=new RegExp('([^"= ]+?)="([^"]+?)"|(data-[^"= ]+?)(?=[" ])',"mg"),l=e.nodeValue;if(r=i.exec(l)){var o=r[1];for(l=l.substring(0,r.index)+l.substring(i.lastIndex),e.nodeValue=l;s=a.exec(o);)s[2]?t.setAttribute(s[1],s[2]):t.setAttribute(s[3],"");return!0}return!1}function o(){var n=e.getRevealElement().querySelectorAll("[data-markdown]:not([data-markdown-parsed])");return[].slice.call(n).forEach((function(e){e.setAttribute("data-markdown-parsed",!0);var n=e.querySelector("aside.notes"),r=t(e);e.innerHTML=ae(r),function e(t,n,r,s,i){if(null!=n&&null!=n.childNodes&&n.childNodes.length>0)for(var a=n,o=0;o<n.childNodes.length;o++){var c=n.childNodes[o];if(o>0)for(var u=o-1;u>=0;){var h=n.childNodes[u];if("function"==typeof h.setAttribute&&"BR"!=h.tagName){a=h;break}u-=1}var p=t;"section"==c.nodeName&&(p=c,a=c),"function"!=typeof c.setAttribute&&c.nodeType!=Node.COMMENT_NODE||e(p,c,a,s,i)}n.nodeType==Node.COMMENT_NODE&&0==l(n,r,s)&&l(n,t,i)}(e,e,null,e.getAttribute("data-element-attributes")||e.parentNode.getAttribute("data-element-attributes")||"\\.element\\s*?(.+?)$",e.getAttribute("data-attributes")||e.parentNode.getAttribute("data-attributes")||"\\.slide:\\s*?(\\S.+?)$"),n&&e.appendChild(n)})),Promise.resolve()}return{id:"markdown",init:function(t){var n=(e=t).getConfig().markdown;return n&&ae.setOptions(n),a(e.getRevealElement()).then(o)},processSlides:a,convertSlides:o,slidify:i,marked:ae}}}));
diff --git a/dist/plugin/math.js b/dist/plugin/math.js
index ac23d0d..58b3041 100644
--- a/dist/plugin/math.js
+++ b/dist/plugin/math.js
@@ -1 +1 @@
-!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).RevealMath=t()}(this,(function(){"use strict";var e=function(){var e=Reveal.getConfig().math||{},t=(e.mathjax||"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js")+"?config="+(e.config||"TeX-AMS_HTML-full"),n={messageStyle:"none",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]],skipTags:["script","noscript","style","textarea","pre"]},skipStartupTypeset:!0};function a(e,t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}return{id:"math",init:function(o){a(e,n),a(e.tex2jax,n.tex2jax),e.mathjax=e.config=null,function(e,t){var n=document.querySelector("head"),a=document.createElement("script");a.type="text/javascript",a.src=e;var o=function(){"function"==typeof t&&(t.call(),t=null)};a.onload=o,a.onreadystatechange=function(){"loaded"===this.readyState&&o()},n.appendChild(a)}(t,(function(){MathJax.Hub.Config(e),MathJax.Hub.Queue(["Typeset",MathJax.Hub]),MathJax.Hub.Queue(o.layout),o.on("slidechanged",(function(e){MathJax.Hub.Queue(["Typeset",MathJax.Hub,e.currentSlide])}))}))}}}();return function(){return e}}));
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).RevealMath=t()}(this,(function(){"use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function n(n){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?t(Object(a),!0).forEach((function(t){e(n,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):t(Object(a)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(a,e))}))}return n}return function(){var e,t={messageStyle:"none",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]],skipTags:["script","noscript","style","textarea","pre"]},skipStartupTypeset:!0};return{id:"math",init:function(r){var a=(e=r).getConfig().math||{},o=n({},t,{},a),c=(o.mathjax||"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js")+"?config="+(o.config||"TeX-AMS_HTML-full");o.tex2jax=n({},t.tex2jax,{},a.tex2jax),o.mathjax=o.config=null,function(e,t){var n=this,r=document.querySelector("head"),a=document.createElement("script");a.type="text/javascript",a.src=e;var o=function(){"function"==typeof t&&(t.call(),t=null)};a.onload=o,a.onreadystatechange=function(){"loaded"===n.readyState&&o()},r.appendChild(a)}(c,(function(){MathJax.Hub.Config(o),MathJax.Hub.Queue(["Typeset",MathJax.Hub,e.getRevealElement()]),MathJax.Hub.Queue(e.layout),e.on("slidechanged",(function(e){MathJax.Hub.Queue(["Typeset",MathJax.Hub,e.currentSlide])}))}))}}}}));
diff --git a/dist/plugin/search.js b/dist/plugin/search.js
index 84eb0cd..d52c13c 100644
--- a/dist/plugin/search.js
+++ b/dist/plugin/search.js
@@ -3,5 +3,5 @@
* Handles finding a text string anywhere in the slides and showing the next occurrence to the user
* by navigatating to that slide and highlighting it.
*
- * By Jon Snyder <snyder.jon@gmail.com>, February 2013
- */var e=function(){var e,t,n,i;function r(e,t){var n=document.getElementById(e)||document.body,i=t||"EM",r=new RegExp("^(?:"+i+"|SCRIPT|FORM)$"),o=["#ff6","#a0ffff","#9f9","#f99","#f6f"],d=[],l=0,a="",c=[];this.setRegex=function(e){e=e.replace(/^[^\w]+|[^\w]+$/g,"").replace(/[^\w'-]+/g,"|"),a=new RegExp("("+e+")","i")},this.getRegex=function(){return a.toString().replace(/^\/\\b\(|\)\\b\/i$/g,"").replace(/\|/g," ")},this.hiliteWords=function(e){if(null!=e&&e&&a&&!r.test(e.nodeName)){if(e.hasChildNodes())for(var t=0;t<e.childNodes.length;t++)this.hiliteWords(e.childNodes[t]);if(3==e.nodeType&&(nv=e.nodeValue)&&(regs=a.exec(nv))){for(var n=e;null!=n&&"SECTION"!=n.nodeName;)n=n.parentNode;var s=Reveal.getIndices(n),u=c.length,h=!1;for(t=0;t<u;t++)c[t].h===s.h&&c[t].v===s.v&&(h=!0);h||c.push(s),d[regs[0].toLowerCase()]||(d[regs[0].toLowerCase()]=o[l++%o.length]);var p=document.createElement(i);p.appendChild(document.createTextNode(regs[0])),p.style.backgroundColor=d[regs[0].toLowerCase()],p.style.fontStyle="inherit",p.style.color="#000";var f=e.splitText(regs.index);f.nodeValue=f.nodeValue.substring(regs[0].length),e.parentNode.insertBefore(p,f)}}},this.remove=function(){for(var e=document.getElementsByTagName(i);e.length&&(el=e[0]);)el.parentNode.replaceChild(el.firstChild,el)},this.apply=function(e){if(null!=e&&e)return this.remove(),this.setRegex(e),this.hiliteWords(n),c}}function o(){var e=document.getElementById("searchinputdiv"),t=document.getElementById("searchinput");e.style.display="inline",t.focus(),t.select()}function d(){document.getElementById("searchinputdiv").style.display="none",i&&i.remove()}function l(){if(n){var o=document.getElementById("searchinput").value;""===o?(i&&i.remove(),e=null):(i=new r("slidecontent"),e=i.apply(o),t=0)}e&&(e.length&&e.length<=t&&(t=0),e.length>t&&(Reveal.slide(e[t].h,e[t].v),t++))}var a={};if(a.wrapper=document.querySelector(".reveal"),!a.wrapper.querySelector(".searchbox")){var c=document.createElement("div");c.id="searchinputdiv",c.classList.add("searchdiv"),c.style.position="absolute",c.style.top="10px",c.style.right="10px",c.style.zIndex=10,c.innerHTML='<span><input type="search" id="searchinput" class="searchinput" style="vertical-align: top;"/><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJiSURBVHjatFZNaxNBGH5md+Mmu92NVdKDRipSAyqCghgQD4L4cRe86UUtAQ+eFCxoa4/25EXBFi8eBE+eRPoDhB6KgiiixdAPCEkx2pjvTXadd9yNsflwuyUDD/O+u8PzzDPvzOwyx3EwyCZhwG3gAkp7MnpjgbopjsltcD4gjuXZZKeAR348MYLYTm3LzOs/y3j3JTfZxgXWXmTuwPHIc4VmoOmv5IrI53+AO2DdHLjkDWQ3GoEEVFXtXQOvkSnPWcyUceviLhwbDYv8/XIVj97kse7TodLvZXxYxrPUHkQ1ufXs3FEdybEIxucySOesoNvUgWU1cP3MkCBfTFdw9fGaAMVmRELq7LBw2Q3/FaAxxWIRpw+ZIr/7IouPqzUBiqmdHAv7EuhRAwf1er2Vy4x1jW3b2d5Jfvu5IPp7l2LYbcgCFFNb+FoJ7oBqEAqFMPNqFcmEgVMJDfMT+1tvN0pNjERlMS6QA5pFOKxiKVPFhakPeL3It+WGJUDxt2wFR+JhzI7v5ctkd8DXOZAkCYYxhO+lKm4+Xfqz/rIixBuNBl7eOYzkQQNzqX249mRl6zUgEcYkaJrGhUwBinVdh6IouPzwE6/DL5w4oLkH8y981aDf+uq6hlKpJESiUdNfDZi7/ehG9K6KfiA3pml0PLcsq+cSMTj2NL9ukc4UOmz7AZ3+crkC4mHujFvXNaMFB3bEr8xPS6p5O+jXxq4VZtaen7/PwzrntjcLUE0iHPS1Ud1cdiEJl/8WivZk0wXd7zWOMkeF8s0CcAmkNrC2nvXZDbbbN73ccYnZoH9bfgswAFzAe9/h3dbKAAAAAElFTkSuQmCC" id="searchbutton" class="searchicon" style="vertical-align: top; margin-top: -1px;"/></span>',a.wrapper.appendChild(c)}return document.getElementById("searchbutton").addEventListener("click",(function(e){l()}),!1),document.getElementById("searchinput").addEventListener("keyup",(function(e){switch(e.keyCode){case 13:e.preventDefault(),l(),n=!1;break;default:n=!0}}),!1),document.addEventListener("keydown",(function(e){"F"==e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),"inline"!==document.getElementById("searchinputdiv").style.display?o():d())}),!1),d(),{id:"search",init:function(e){e.registerKeyboardShortcut("CTRL + Shift + F","Search")},open:o}}();return function(){return e}}));
+ * @author Jon Snyder <snyder.jon@gmail.com>, February 2013
+ */return function(){var e,t,n,o,i,l,r;function s(){(t=document.createElement("div")).classList.add("searchbox"),t.style.position="absolute",t.style.top="10px",t.style.right="10px",t.style.zIndex=10,t.innerHTML='<input type="search" class="searchinput" placeholder="Search..." style="vertical-align: top;"/>\n\t\t</span>',(n=t.querySelector(".searchinput")).style.width="240px",n.style.fontSize="14px",n.style.padding="4px 6px",n.style.color="#000",n.style.background="#fff",n.style.borderRadius="2px",n.style.border="0",n.style.outline="0",n.style.boxShadow="0 2px 18px rgba(0, 0, 0, 0.2)",n.style["-webkit-appearance"]="none",e.getRevealElement().appendChild(t),n.addEventListener("keyup",(function(t){switch(t.keyCode){case 13:t.preventDefault(),function(){if(l){var t=n.value;""===t?(r&&r.remove(),o=null):(r=new c("slidecontent"),o=r.apply(t),i=0)}o&&(o.length&&o.length<=i&&(i=0),o.length>i&&(e.slide(o[i].h,o[i].v),i++))}(),l=!1;break;default:l=!0}}),!1),d()}function a(){t||s(),t.style.display="inline",n.focus(),n.select()}function d(){t||s(),t.style.display="none",r&&r.remove()}function c(t,n){var o=document.getElementById(t)||document.body,i=n||"EM",l=new RegExp("^(?:"+i+"|SCRIPT|FORM)$"),r=["#ff6","#a0ffff","#9f9","#f99","#f6f"],s=[],a=0,d="",c=[];this.setRegex=function(e){e=e.replace(/^[^\w]+|[^\w]+$/g,"").replace(/[^\w'-]+/g,"|"),d=new RegExp("("+e+")","i")},this.getRegex=function(){return d.toString().replace(/^\/\\b\(|\)\\b\/i$/g,"").replace(/\|/g," ")},this.hiliteWords=function(t){if(null!=t&&t&&d&&!l.test(t.nodeName)){if(t.hasChildNodes())for(var n=0;n<t.childNodes.length;n++)this.hiliteWords(t.childNodes[n]);var o,f;if(3==t.nodeType)if((o=t.nodeValue)&&(f=d.exec(o))){for(var u=t;null!=u&&"SECTION"!=u.nodeName;)u=u.parentNode;var p=e.getIndices(u),h=c.length,y=!1;for(n=0;n<h;n++)c[n].h===p.h&&c[n].v===p.v&&(y=!0);y||c.push(p),s[f[0].toLowerCase()]||(s[f[0].toLowerCase()]=r[a++%r.length]);var g=document.createElement(i);g.appendChild(document.createTextNode(f[0])),g.style.backgroundColor=s[f[0].toLowerCase()],g.style.fontStyle="inherit",g.style.color="#000";var v=t.splitText(f.index);v.nodeValue=v.nodeValue.substring(f[0].length),t.parentNode.insertBefore(g,v)}}},this.remove=function(){for(var e,t=document.getElementsByTagName(i);t.length&&(e=t[0]);)e.parentNode.replaceChild(e.firstChild,e)},this.apply=function(e){if(null!=e&&e)return this.remove(),this.setRegex(e),this.hiliteWords(o),c}}return{id:"search",init:function(n){(e=n).registerKeyboardShortcut("CTRL + Shift + F","Search"),document.addEventListener("keydown",(function(e){"F"==e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),t||s(),"inline"!==t.style.display?a():d())}),!1)},open:a}}}));
diff --git a/examples/multiple-presentations.html b/examples/multiple-presentations.html
index 125bf0a..e7965a8 100644
--- a/examples/multiple-presentations.html
+++ b/examples/multiple-presentations.html
@@ -10,6 +10,7 @@
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../dist/theme/white.css" id="theme">
+ <link rel="stylesheet" href="../lib/css/monokai.css">
</head>
<body style="background: #ddd;">
@@ -19,6 +20,14 @@
<div class="slides">
<section>Deck 1, Slide 1</section>
<section>Deck 1, Slide 2</section>
+ <section>
+ <pre data-id="code-animation"><code class="hljs" data-trim data-line-numbers>
+ import React, { useState } from 'react';
+ function Example() {
+ const [count, setCount] = useState(0);
+ }
+ </code></pre>
+ </section>
</div>
</div>
@@ -26,16 +35,38 @@
<div class="slides">
<section>Deck 2, Slide 1</section>
<section>Deck 2, Slide 2</section>
+ <section data-markdown>
+ <script type="text/template">
+ ## Markdown plugin
+
+ - 1
+ - 2
+ - 3
+ </script>
+ </section>
+ <section>
+ <h3>The Lorenz Equations</h3>
+
+ \[\begin{aligned}
+ \dot{x} &amp; = \sigma(y-x) \\
+ \dot{y} &amp; = \rho x - y - xz \\
+ \dot{z} &amp; = -\beta z + xy
+ \end{aligned} \]
+ </section>
</div>
</div>
</div>
<script src="../dist/reveal.es5.js"></script>
+ <script src="../dist/plugin/highlight.js"></script>
+ <script src="../dist/plugin/markdown.js"></script>
+ <script src="../dist/plugin/math.js"></script>
<script>
let deck1 = new Reveal( document.querySelector( '.deck1' ), {
embedded: true,
- keyboard: false
+ keyboard: false,
+ plugins: [ RevealHighlight ]
} );
deck1.on( 'slidechanged', () => {
console.log( 'Deck 1 slide changed' );
@@ -44,7 +75,8 @@
let deck2 = new Reveal( document.querySelector( '.deck2' ), {
embedded: true,
- keyboard: false
+ keyboard: true,
+ plugins: [ RevealMarkdown, RevealMath ]
} );
deck2.initialize().then( () => {
deck2.slide(1);
diff --git a/plugin/highlight/highlight.js b/plugin/highlight/highlight.js
index 9fa4fa2..4dd9635 100644
--- a/plugin/highlight/highlight.js
+++ b/plugin/highlight/highlight.js
@@ -13,14 +13,22 @@ let Plugin = {
HIGHLIGHT_LINE_DELIMITER: ',',
HIGHLIGHT_LINE_RANGE_DELIMITER: '-',
- init: function( deck ) {
+ /**
+ * Highlights code blocks withing the given deck.
+ *
+ * Note that this can be called multiple times if
+ * there are multiple presentations on one page.
+ *
+ * @param {Reveal} reveal the reveal.js instance
+ */
+ init: function( reveal ) {
// Read the plugin config options and provide fallbacks
- var config = deck.getConfig().highlight || {};
+ var config = reveal.getConfig().highlight || {};
config.highlightOnLoad = typeof config.highlightOnLoad === 'boolean' ? config.highlightOnLoad : true;
config.escapeHTML = typeof config.escapeHTML === 'boolean' ? config.escapeHTML : true;
- [].slice.call( document.querySelectorAll( '.reveal pre code' ) ).forEach( function( block ) {
+ [].slice.call( reveal.getRevealElement().querySelectorAll( 'pre code' ) ).forEach( function( block ) {
// Trim whitespace if the "data-trim" attribute is present
if( block.hasAttribute( 'data-trim' ) && typeof block.innerHTML.trim === 'function' ) {
@@ -45,8 +53,8 @@ let Plugin = {
// If we're printing to PDF, scroll the code highlights of
// all blocks in the deck into view at once
- deck.on( 'pdf-ready', function() {
- [].slice.call( document.querySelectorAll( '.reveal pre code[data-line-numbers].current-fragment' ) ).forEach( function( block ) {
+ reveal.on( 'pdf-ready', function() {
+ [].slice.call( reveal.getRevealElement().querySelectorAll( 'pre code[data-line-numbers].current-fragment' ) ).forEach( function( block ) {
Plugin.scrollHighlightedLineIntoView( block, {}, true );
} );
} );
diff --git a/plugin/markdown/markdown.js b/plugin/markdown/markdown.js
index 9114078..803b298 100755
--- a/plugin/markdown/markdown.js
+++ b/plugin/markdown/markdown.js
@@ -6,429 +6,435 @@
import marked from './marked.js'
-let Plugin = {
+const DEFAULT_SLIDE_SEPARATOR = '^\r?\n---\r?\n$',
+ DEFAULT_NOTES_SEPARATOR = 'notes?:',
+ DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR = '\\\.element\\\s*?(.+?)$',
+ DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR = '\\\.slide:\\\s*?(\\\S.+?)$';
- id: 'markdown',
+const SCRIPT_END_PLACEHOLDER = '__SCRIPT_END__';
- /**
- * Starts processing and converting Markdown within the
- * current reveal.js deck.
- */
- init: function( deck ) {
+const Plugin = () => {
- // This should no longer be needed, as long as the highlight.js
- // plugin is included after the markdown plugin
- // if( typeof window.hljs !== 'undefined' ) {
- // marked.setOptions({
- // highlight: function( code, lang ) {
- // return window.hljs.highlightAuto( code, lang ? [lang] : null ).value;
- // }
- // });
- // }
+ // The reveal.js instance this plugin is attached to
+ let deck;
- // marked can be configured via reveal.js config options
- var options = deck.getConfig().markdown;
- if( options ) {
- marked.setOptions( options );
- }
+ /**
+ * Retrieves the markdown contents of a slide section
+ * element. Normalizes leading tabs/whitespace.
+ */
+ function getMarkdownFromSlide( section ) {
- return processSlides( deck.getRevealElement() ).then( convertSlides );
+ // look for a <script> or <textarea data-template> wrapper
+ var template = section.querySelector( '[data-template]' ) || section.querySelector( 'script' );
- },
+ // strip leading whitespace so it isn't evaluated as code
+ var text = ( template || section ).textContent;
- // TODO: Do these belong in the API?
- processSlides: processSlides,
- convertSlides: convertSlides,
- slidify: slidify,
- marked: marked
+ // restore script end tags
+ text = text.replace( new RegExp( SCRIPT_END_PLACEHOLDER, 'g' ), '</script>' );
-};
+ var leadingWs = text.match( /^\n?(\s*)/ )[1].length,
+ leadingTabs = text.match( /^\n?(\t*)/ )[1].length;
-export default () => Plugin;
+ if( leadingTabs > 0 ) {
+ text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}','g'), '\n' );
+ }
+ else if( leadingWs > 1 ) {
+ text = text.replace( new RegExp('\\n? {' + leadingWs + '}', 'g'), '\n' );
+ }
-var DEFAULT_SLIDE_SEPARATOR = '^\r?\n---\r?\n$',
- DEFAULT_NOTES_SEPARATOR = 'notes?:',
- DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR = '\\\.element\\\s*?(.+?)$',
- DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR = '\\\.slide:\\\s*?(\\\S.+?)$';
+ return text;
-var SCRIPT_END_PLACEHOLDER = '__SCRIPT_END__';
+ }
+ /**
+ * Given a markdown slide section element, this will
+ * return all arguments that aren't related to markdown
+ * parsing. Used to forward any other user-defined arguments
+ * to the output markdown slide.
+ */
+ function getForwardedAttributes( section ) {
-/**
- * Retrieves the markdown contents of a slide section
- * element. Normalizes leading tabs/whitespace.
- */
-function getMarkdownFromSlide( section ) {
+ var attributes = section.attributes;
+ var result = [];
- // look for a <script> or <textarea data-template> wrapper
- var template = section.querySelector( '[data-template]' ) || section.querySelector( 'script' );
+ for( var i = 0, len = attributes.length; i < len; i++ ) {
+ var name = attributes[i].name,
+ value = attributes[i].value;
- // strip leading whitespace so it isn't evaluated as code
- var text = ( template || section ).textContent;
+ // disregard attributes that are used for markdown loading/parsing
+ if( /data\-(markdown|separator|vertical|notes)/gi.test( name ) ) continue;
- // restore script end tags
- text = text.replace( new RegExp( SCRIPT_END_PLACEHOLDER, 'g' ), '</script>' );
+ if( value ) {
+ result.push( name + '="' + value + '"' );
+ }
+ else {
+ result.push( name );
+ }
+ }
- var leadingWs = text.match( /^\n?(\s*)/ )[1].length,
- leadingTabs = text.match( /^\n?(\t*)/ )[1].length;
+ return result.join( ' ' );
- if( leadingTabs > 0 ) {
- text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}','g'), '\n' );
}
- else if( leadingWs > 1 ) {
- text = text.replace( new RegExp('\\n? {' + leadingWs + '}', 'g'), '\n' );
- }
-
- return text;
-
-}
-
-/**
- * Given a markdown slide section element, this will
- * return all arguments that aren't related to markdown
- * parsing. Used to forward any other user-defined arguments
- * to the output markdown slide.
- */
-function getForwardedAttributes( section ) {
- var attributes = section.attributes;
- var result = [];
+ /**
+ * Inspects the given options and fills out default
+ * values for what's not defined.
+ */
+ function getSlidifyOptions( options ) {
- for( var i = 0, len = attributes.length; i < len; i++ ) {
- var name = attributes[i].name,
- value = attributes[i].value;
+ options = options || {};
+ options.separator = options.separator || DEFAULT_SLIDE_SEPARATOR;
+ options.notesSeparator = options.notesSeparator || DEFAULT_NOTES_SEPARATOR;
+ options.attributes = options.attributes || '';
- // disregard attributes that are used for markdown loading/parsing
- if( /data\-(markdown|separator|vertical|notes)/gi.test( name ) ) continue;
+ return options;
- if( value ) {
- result.push( name + '="' + value + '"' );
- }
- else {
- result.push( name );
- }
}
- return result.join( ' ' );
-
-}
-
-/**
- * Inspects the given options and fills out default
- * values for what's not defined.
- */
-function getSlidifyOptions( options ) {
-
- options = options || {};
- options.separator = options.separator || DEFAULT_SLIDE_SEPARATOR;
- options.notesSeparator = options.notesSeparator || DEFAULT_NOTES_SEPARATOR;
- options.attributes = options.attributes || '';
+ /**
+ * Helper function for constructing a markdown slide.
+ */
+ function createMarkdownSlide( content, options ) {
- return options;
+ options = getSlidifyOptions( options );
-}
+ var notesMatch = content.split( new RegExp( options.notesSeparator, 'mgi' ) );
-/**
- * Helper function for constructing a markdown slide.
- */
-function createMarkdownSlide( content, options ) {
+ if( notesMatch.length === 2 ) {
+ content = notesMatch[0] + '<aside class="notes">' + marked(notesMatch[1].trim()) + '</aside>';
+ }
- options = getSlidifyOptions( options );
+ // prevent script end tags in the content from interfering
+ // with parsing
+ content = content.replace( /<\/script>/g, SCRIPT_END_PLACEHOLDER );
- var notesMatch = content.split( new RegExp( options.notesSeparator, 'mgi' ) );
+ return '<script type="text/template">' + content + '</script>';
- if( notesMatch.length === 2 ) {
- content = notesMatch[0] + '<aside class="notes">' + marked(notesMatch[1].trim()) + '</aside>';
}
- // prevent script end tags in the content from interfering
- // with parsing
- content = content.replace( /<\/script>/g, SCRIPT_END_PLACEHOLDER );
+ /**
+ * Parses a data string into multiple slides based
+ * on the passed in separator arguments.
+ */
+ function slidify( markdown, options ) {
- return '<script type="text/template">' + content + '</script>';
+ options = getSlidifyOptions( options );
-}
+ var separatorRegex = new RegExp( options.separator + ( options.verticalSeparator ? '|' + options.verticalSeparator : '' ), 'mg' ),
+ horizontalSeparatorRegex = new RegExp( options.separator );
-/**
- * Parses a data string into multiple slides based
- * on the passed in separator arguments.
- */
-function slidify( markdown, options ) {
+ var matches,
+ lastIndex = 0,
+ isHorizontal,
+ wasHorizontal = true,
+ content,
+ sectionStack = [];
- options = getSlidifyOptions( options );
+ // iterate until all blocks between separators are stacked up
+ while( matches = separatorRegex.exec( markdown ) ) {
+ var notes = null;
- var separatorRegex = new RegExp( options.separator + ( options.verticalSeparator ? '|' + options.verticalSeparator : '' ), 'mg' ),
- horizontalSeparatorRegex = new RegExp( options.separator );
+ // determine direction (horizontal by default)
+ isHorizontal = horizontalSeparatorRegex.test( matches[0] );
- var matches,
- lastIndex = 0,
- isHorizontal,
- wasHorizontal = true,
- content,
- sectionStack = [];
+ if( !isHorizontal && wasHorizontal ) {
+ // create vertical stack
+ sectionStack.push( [] );
+ }
- // iterate until all blocks between separators are stacked up
- while( matches = separatorRegex.exec( markdown ) ) {
- var notes = null;
+ // pluck slide content from markdown input
+ content = markdown.substring( lastIndex, matches.index );
- // determine direction (horizontal by default)
- isHorizontal = horizontalSeparatorRegex.test( matches[0] );
+ if( isHorizontal && wasHorizontal ) {
+ // add to horizontal stack
+ sectionStack.push( content );
+ }
+ else {
+ // add to vertical stack
+ sectionStack[sectionStack.length-1].push( content );
+ }
- if( !isHorizontal && wasHorizontal ) {
- // create vertical stack
- sectionStack.push( [] );
+ lastIndex = separatorRegex.lastIndex;
+ wasHorizontal = isHorizontal;
}
- // pluck slide content from markdown input
- content = markdown.substring( lastIndex, matches.index );
+ // add the remaining slide
+ ( wasHorizontal ? sectionStack : sectionStack[sectionStack.length-1] ).push( markdown.substring( lastIndex ) );
- if( isHorizontal && wasHorizontal ) {
- // add to horizontal stack
- sectionStack.push( content );
- }
- else {
- // add to vertical stack
- sectionStack[sectionStack.length-1].push( content );
- }
-
- lastIndex = separatorRegex.lastIndex;
- wasHorizontal = isHorizontal;
- }
+ var markdownSections = '';
- // add the remaining slide
- ( wasHorizontal ? sectionStack : sectionStack[sectionStack.length-1] ).push( markdown.substring( lastIndex ) );
+ // flatten the hierarchical stack, and insert <section data-markdown> tags
+ for( var i = 0, len = sectionStack.length; i < len; i++ ) {
+ // vertical
+ if( sectionStack[i] instanceof Array ) {
+ markdownSections += '<section '+ options.attributes +'>';
- var markdownSections = '';
+ sectionStack[i].forEach( function( child ) {
+ markdownSections += '<section data-markdown>' + createMarkdownSlide( child, options ) + '</section>';
+ } );
- // flatten the hierarchical stack, and insert <section data-markdown> tags
- for( var i = 0, len = sectionStack.length; i < len; i++ ) {
- // vertical
- if( sectionStack[i] instanceof Array ) {
- markdownSections += '<section '+ options.attributes +'>';
+ markdownSections += '</section>';
+ }
+ else {
+ markdownSections += '<section '+ options.attributes +' data-markdown>' + createMarkdownSlide( sectionStack[i], options ) + '</section>';
+ }
+ }
- sectionStack[i].forEach( function( child ) {
- markdownSections += '<section data-markdown>' + createMarkdownSlide( child, options ) + '</section>';
- } );
+ return markdownSections;
- markdownSections += '</section>';
- }
- else {
- markdownSections += '<section '+ options.attributes +' data-markdown>' + createMarkdownSlide( sectionStack[i], options ) + '</section>';
- }
}
- return markdownSections;
+ /**
+ * Parses any current data-markdown slides, splits
+ * multi-slide markdown into separate sections and
+ * handles loading of external markdown.
+ */
+ function processSlides( scope ) {
-}
+ return new Promise( function( resolve ) {
-/**
- * Parses any current data-markdown slides, splits
- * multi-slide markdown into separate sections and
- * handles loading of external markdown.
- */
-function processSlides( scope ) {
+ var externalPromises = [];
- return new Promise( function( resolve ) {
+ [].slice.call( scope.querySelectorAll( '[data-markdown]:not([data-markdown-parsed])') ).forEach( function( section, i ) {
- var externalPromises = [];
+ if( section.getAttribute( 'data-markdown' ).length ) {
- [].slice.call( scope.querySelectorAll( '[data-markdown]:not([data-markdown-parsed])') ).forEach( function( section, i ) {
+ externalPromises.push( loadExternalMarkdown( section ).then(
- if( section.getAttribute( 'data-markdown' ).length ) {
+ // Finished loading external file
+ function( xhr, url ) {
+ section.outerHTML = slidify( xhr.responseText, {
+ separator: section.getAttribute( 'data-separator' ),
+ verticalSeparator: section.getAttribute( 'data-separator-vertical' ),
+ notesSeparator: section.getAttribute( 'data-separator-notes' ),
+ attributes: getForwardedAttributes( section )
+ });
+ },
- externalPromises.push( loadExternalMarkdown( section ).then(
+ // Failed to load markdown
+ function( xhr, url ) {
+ section.outerHTML = '<section data-state="alert">' +
+ 'ERROR: The attempt to fetch ' + url + ' failed with HTTP status ' + xhr.status + '.' +
+ 'Check your browser\'s JavaScript console for more details.' +
+ '<p>Remember that you need to serve the presentation HTML from a HTTP server.</p>' +
+ '</section>';
+ }
- // Finished loading external file
- function( xhr, url ) {
- section.outerHTML = slidify( xhr.responseText, {
- separator: section.getAttribute( 'data-separator' ),
- verticalSeparator: section.getAttribute( 'data-separator-vertical' ),
- notesSeparator: section.getAttribute( 'data-separator-notes' ),
- attributes: getForwardedAttributes( section )
- });
- },
+ ) );
- // Failed to load markdown
- function( xhr, url ) {
- section.outerHTML = '<section data-state="alert">' +
- 'ERROR: The attempt to fetch ' + url + ' failed with HTTP status ' + xhr.status + '.' +
- 'Check your browser\'s JavaScript console for more details.' +
- '<p>Remember that you need to serve the presentation HTML from a HTTP server.</p>' +
- '</section>';
- }
+ }
+ else if( section.getAttribute( 'data-separator' ) || section.getAttribute( 'data-separator-vertical' ) || section.getAttribute( 'data-separator-notes' ) ) {
- ) );
+ section.outerHTML = slidify( getMarkdownFromSlide( section ), {
+ separator: section.getAttribute( 'data-separator' ),
+ verticalSeparator: section.getAttribute( 'data-separator-vertical' ),
+ notesSeparator: section.getAttribute( 'data-separator-notes' ),
+ attributes: getForwardedAttributes( section )
+ });
- }
- else if( section.getAttribute( 'data-separator' ) || section.getAttribute( 'data-separator-vertical' ) || section.getAttribute( 'data-separator-notes' ) ) {
+ }
+ else {
+ section.innerHTML = createMarkdownSlide( getMarkdownFromSlide( section ) );
+ }
- section.outerHTML = slidify( getMarkdownFromSlide( section ), {
- separator: section.getAttribute( 'data-separator' ),
- verticalSeparator: section.getAttribute( 'data-separator-vertical' ),
- notesSeparator: section.getAttribute( 'data-separator-notes' ),
- attributes: getForwardedAttributes( section )
- });
+ });
- }
- else {
- section.innerHTML = createMarkdownSlide( getMarkdownFromSlide( section ) );
- }
+ Promise.all( externalPromises ).then( resolve );
- });
+ } );
- Promise.all( externalPromises ).then( resolve );
+ }
- } );
+ function loadExternalMarkdown( section ) {
-}
+ return new Promise( function( resolve, reject ) {
-function loadExternalMarkdown( section ) {
+ var xhr = new XMLHttpRequest(),
+ url = section.getAttribute( 'data-markdown' );
- return new Promise( function( resolve, reject ) {
+ var datacharset = section.getAttribute( 'data-charset' );
- var xhr = new XMLHttpRequest(),
- url = section.getAttribute( 'data-markdown' );
+ // see https://developer.mozilla.org/en-US/docs/Web/API/element.getAttribute#Notes
+ if( datacharset != null && datacharset != '' ) {
+ xhr.overrideMimeType( 'text/html; charset=' + datacharset );
+ }
- var datacharset = section.getAttribute( 'data-charset' );
+ xhr.onreadystatechange = function( section, xhr ) {
+ if( xhr.readyState === 4 ) {
+ // file protocol yields status code 0 (useful for local debug, mobile applications etc.)
+ if ( ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status === 0 ) {
- // see https://developer.mozilla.org/en-US/docs/Web/API/element.getAttribute#Notes
- if( datacharset != null && datacharset != '' ) {
- xhr.overrideMimeType( 'text/html; charset=' + datacharset );
- }
+ resolve( xhr, url );
- xhr.onreadystatechange = function( section, xhr ) {
- if( xhr.readyState === 4 ) {
- // file protocol yields status code 0 (useful for local debug, mobile applications etc.)
- if ( ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status === 0 ) {
+ }
+ else {
- resolve( xhr, url );
+ reject( xhr, url );
+ }
}
- else {
+ }.bind( this, section, xhr );
- reject( xhr, url );
+ xhr.open( 'GET', url, true );
- }
+ try {
+ xhr.send();
+ }
+ catch ( e ) {
+ console.warn( 'Failed to get the Markdown file ' + url + '. Make sure that the presentation and the file are served by a HTTP server and the file can be found there. ' + e );
+ resolve( xhr, url );
}
- }.bind( this, section, xhr );
-
- xhr.open( 'GET', url, true );
-
- try {
- xhr.send();
- }
- catch ( e ) {
- console.warn( 'Failed to get the Markdown file ' + url + '. Make sure that the presentation and the file are served by a HTTP server and the file can be found there. ' + e );
- resolve( xhr, url );
- }
- } );
+ } );
-}
+ }
-/**
- * Check if a node value has the attributes pattern.
- * If yes, extract it and add that value as one or several attributes
- * to the target element.
- *
- * You need Cache Killer on Chrome to see the effect on any FOM transformation
- * directly on refresh (F5)
- * http://stackoverflow.com/questions/5690269/disabling-chrome-cache-for-website-development/7000899#answer-11786277
- */
-function addAttributeInElement( node, elementTarget, separator ) {
+ /**
+ * Check if a node value has the attributes pattern.
+ * If yes, extract it and add that value as one or several attributes
+ * to the target element.
+ *
+ * You need Cache Killer on Chrome to see the effect on any FOM transformation
+ * directly on refresh (F5)
+ * http://stackoverflow.com/questions/5690269/disabling-chrome-cache-for-website-development/7000899#answer-11786277
+ */
+ function addAttributeInElement( node, elementTarget, separator ) {
- var mardownClassesInElementsRegex = new RegExp( separator, 'mg' );
- var mardownClassRegex = new RegExp( "([^\"= ]+?)=\"([^\"]+?)\"|(data-[^\"= ]+?)(?=[\" ])", 'mg' );
- var nodeValue = node.nodeValue;
- var matches,
- matchesClass;
- if( matches = mardownClassesInElementsRegex.exec( nodeValue ) ) {
+ var mardownClassesInElementsRegex = new RegExp( separator, 'mg' );
+ var mardownClassRegex = new RegExp( "([^\"= ]+?)=\"([^\"]+?)\"|(data-[^\"= ]+?)(?=[\" ])", 'mg' );
+ var nodeValue = node.nodeValue;
+ var matches,
+ matchesClass;
+ if( matches = mardownClassesInElementsRegex.exec( nodeValue ) ) {
- var classes = matches[1];
- nodeValue = nodeValue.substring( 0, matches.index ) + nodeValue.substring( mardownClassesInElementsRegex.lastIndex );
- node.nodeValue = nodeValue;
- while( matchesClass = mardownClassRegex.exec( classes ) ) {
- if( matchesClass[2] ) {
- elementTarget.setAttribute( matchesClass[1], matchesClass[2] );
- } else {
- elementTarget.setAttribute( matchesClass[3], "" );
+ var classes = matches[1];
+ nodeValue = nodeValue.substring( 0, matches.index ) + nodeValue.substring( mardownClassesInElementsRegex.lastIndex );
+ node.nodeValue = nodeValue;
+ while( matchesClass = mardownClassRegex.exec( classes ) ) {
+ if( matchesClass[2] ) {
+ elementTarget.setAttribute( matchesClass[1], matchesClass[2] );
+ } else {
+ elementTarget.setAttribute( matchesClass[3], "" );
+ }
}
+ return true;
}
- return true;
+ return false;
}
- return false;
-}
-/**
- * Add attributes to the parent element of a text node,
- * or the element of an attribute node.
- */
-function addAttributes( section, element, previousElement, separatorElementAttributes, separatorSectionAttributes ) {
+ /**
+ * Add attributes to the parent element of a text node,
+ * or the element of an attribute node.
+ */
+ function addAttributes( section, element, previousElement, separatorElementAttributes, separatorSectionAttributes ) {
- if ( element != null && element.childNodes != undefined && element.childNodes.length > 0 ) {
- var previousParentElement = element;
- for( var i = 0; i < element.childNodes.length; i++ ) {
- var childElement = element.childNodes[i];
- if ( i > 0 ) {
- var j = i - 1;
- while ( j >= 0 ) {
- var aPreviousChildElement = element.childNodes[j];
- if ( typeof aPreviousChildElement.setAttribute == 'function' && aPreviousChildElement.tagName != "BR" ) {
- previousParentElement = aPreviousChildElement;
- break;
+ if ( element != null && element.childNodes != undefined && element.childNodes.length > 0 ) {
+ var previousParentElement = element;
+ for( var i = 0; i < element.childNodes.length; i++ ) {
+ var childElement = element.childNodes[i];
+ if ( i > 0 ) {
+ var j = i - 1;
+ while ( j >= 0 ) {
+ var aPreviousChildElement = element.childNodes[j];
+ if ( typeof aPreviousChildElement.setAttribute == 'function' && aPreviousChildElement.tagName != "BR" ) {
+ previousParentElement = aPreviousChildElement;
+ break;
+ }
+ j = j - 1;
}
- j = j - 1;
+ }
+ var parentSection = section;
+ if( childElement.nodeName == "section" ) {
+ parentSection = childElement ;
+ previousParentElement = childElement ;
+ }
+ if ( typeof childElement.setAttribute == 'function' || childElement.nodeType == Node.COMMENT_NODE ) {
+ addAttributes( parentSection, childElement, previousParentElement, separatorElementAttributes, separatorSectionAttributes );
}
}
- var parentSection = section;
- if( childElement.nodeName == "section" ) {
- parentSection = childElement ;
- previousParentElement = childElement ;
- }
- if ( typeof childElement.setAttribute == 'function' || childElement.nodeType == Node.COMMENT_NODE ) {
- addAttributes( parentSection, childElement, previousParentElement, separatorElementAttributes, separatorSectionAttributes );
+ }
+
+ if ( element.nodeType == Node.COMMENT_NODE ) {
+ if ( addAttributeInElement( element, previousElement, separatorElementAttributes ) == false ) {
+ addAttributeInElement( element, section, separatorSectionAttributes );
}
}
}
- if ( element.nodeType == Node.COMMENT_NODE ) {
- if ( addAttributeInElement( element, previousElement, separatorElementAttributes ) == false ) {
- addAttributeInElement( element, section, separatorSectionAttributes );
- }
+ /**
+ * Converts any current data-markdown slides in the
+ * DOM to HTML.
+ */
+ function convertSlides() {
+
+ var sections = deck.getRevealElement().querySelectorAll( '[data-markdown]:not([data-markdown-parsed])');
+
+ [].slice.call( sections ).forEach( function( section ) {
+
+ section.setAttribute( 'data-markdown-parsed', true )
+
+ var notes = section.querySelector( 'aside.notes' );
+ var markdown = getMarkdownFromSlide( section );
+
+ section.innerHTML = marked( markdown );
+ addAttributes( section, section, null, section.getAttribute( 'data-element-attributes' ) ||
+ section.parentNode.getAttribute( 'data-element-attributes' ) ||
+ DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR,
+ section.getAttribute( 'data-attributes' ) ||
+ section.parentNode.getAttribute( 'data-attributes' ) ||
+ DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR);
+
+ // If there were notes, we need to re-add them after
+ // having overwritten the section's HTML
+ if( notes ) {
+ section.appendChild( notes );
+ }
+
+ } );
+
+ return Promise.resolve();
+
}
-}
-/**
- * Converts any current data-markdown slides in the
- * DOM to HTML.
- */
-function convertSlides() {
+ return {
+ id: 'markdown',
- var sections = document.querySelectorAll( '[data-markdown]:not([data-markdown-parsed])');
+ /**
+ * Starts processing and converting Markdown within the
+ * current reveal.js deck.
+ */
+ init: function( reveal ) {
- [].slice.call( sections ).forEach( function( section ) {
+ deck = reveal;
- section.setAttribute( 'data-markdown-parsed', true )
+ // This should no longer be needed, as long as the highlight.js
+ // plugin is included after the markdown plugin
+ // if( typeof window.hljs !== 'undefined' ) {
+ // marked.setOptions({
+ // highlight: function( code, lang ) {
+ // return window.hljs.highlightAuto( code, lang ? [lang] : null ).value;
+ // }
+ // });
+ // }
- var notes = section.querySelector( 'aside.notes' );
- var markdown = getMarkdownFromSlide( section );
+ // marked can be configured via reveal.js config options
+ var options = deck.getConfig().markdown;
+ if( options ) {
+ marked.setOptions( options );
+ }
- section.innerHTML = marked( markdown );
- addAttributes( section, section, null, section.getAttribute( 'data-element-attributes' ) ||
- section.parentNode.getAttribute( 'data-element-attributes' ) ||
- DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR,
- section.getAttribute( 'data-attributes' ) ||
- section.parentNode.getAttribute( 'data-attributes' ) ||
- DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR);
+ return processSlides( deck.getRevealElement() ).then( convertSlides );
- // If there were notes, we need to re-add them after
- // having overwritten the section's HTML
- if( notes ) {
- section.appendChild( notes );
- }
+ },
- } );
+ // TODO: Do these belong in the API?
+ processSlides: processSlides,
+ convertSlides: convertSlides,
+ slidify: slidify,
+ marked: marked
+ }
- return Promise.resolve();
+};
-}
+export default Plugin;
diff --git a/plugin/math/math.js b/plugin/math/math.js
index 25f50cb..eaef379 100755
--- a/plugin/math/math.js
+++ b/plugin/math/math.js
@@ -4,14 +4,12 @@
*
* @author Hakim El Hattab
*/
-let Plugin = (function(){
+const Plugin = () => {
- var options = Reveal.getConfig().math || {};
- var mathjax = options.mathjax || 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js';
- var config = options.config || 'TeX-AMS_HTML-full';
- var url = mathjax + '?config=' + config;
+ // The reveal.js instance this plugin is attached to
+ let deck;
- var defaultOptions = {
+ let defaultOptions = {
messageStyle: 'none',
tex2jax: {
inlineMath: [ [ '$', '$' ], [ '\\(', '\\)' ] ],
@@ -20,25 +18,15 @@ let Plugin = (function(){
skipStartupTypeset: true
};
- function defaults( options, defaultOptions ) {
-
- for ( var i in defaultOptions ) {
- if ( !options.hasOwnProperty( i ) ) {
- options[i] = defaultOptions[i];
- }
- }
-
- }
-
function loadScript( url, callback ) {
- var head = document.querySelector( 'head' );
- var script = document.createElement( 'script' );
+ let head = document.querySelector( 'head' );
+ let script = document.createElement( 'script' );
script.type = 'text/javascript';
script.src = url;
// Wrapper for callback to make sure it only fires once
- var finish = function() {
+ let finish = () => {
if( typeof callback === 'function' ) {
callback.call();
callback = null;
@@ -48,7 +36,7 @@ let Plugin = (function(){
script.onload = finish;
// IE
- script.onreadystatechange = function() {
+ script.onreadystatechange = () => {
if ( this.readyState === 'loaded' ) {
finish();
}
@@ -62,10 +50,19 @@ let Plugin = (function(){
return {
id: 'math',
- init: function( deck ) {
+ init: function( reveal ) {
+
+ deck = reveal;
+
+ let revealOptions = deck.getConfig().math || {};
+
+ let options = { ...defaultOptions, ...revealOptions };
+ let mathjax = options.mathjax || 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js';
+ let config = options.config || 'TeX-AMS_HTML-full';
+ let url = mathjax + '?config=' + config;
+
+ options.tex2jax = { ...defaultOptions.tex2jax, ...revealOptions.tex2jax };
- defaults( options, defaultOptions );
- defaults( options.tex2jax, defaultOptions.tex2jax );
options.mathjax = options.config = null;
loadScript( url, function() {
@@ -74,7 +71,7 @@ let Plugin = (function(){
// Typeset followed by an immediate reveal.js layout since
// the typesetting process could affect slide height
- MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub ] );
+ MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub, deck.getRevealElement() ] );
MathJax.Hub.Queue( deck.layout );
// Reprocess equations in slides when they turn visible
@@ -89,6 +86,6 @@ let Plugin = (function(){
}
}
-})();
+};
-export default () => Plugin;
+export default Plugin;
diff --git a/plugin/search/search.js b/plugin/search/search.js
index cc39ef0..5d09ce6 100644
--- a/plugin/search/search.js
+++ b/plugin/search/search.js
@@ -2,130 +2,89 @@
* Handles finding a text string anywhere in the slides and showing the next occurrence to the user
* by navigatating to that slide and highlighting it.
*
- * By Jon Snyder <snyder.jon@gmail.com>, February 2013
+ * @author Jon Snyder <snyder.jon@gmail.com>, February 2013
*/
-var Plugin = (function() {
+const Plugin = () => {
- var matchedSlides;
- var currentMatchedIndex;
- var searchboxDirty;
- var myHilitor;
+ // The reveal.js instance this plugin is attached to
+ let deck;
-// Original JavaScript code by Chirp Internet: www.chirp.com.au
-// Please acknowledge use of this code by including this header.
-// 2/2013 jon: modified regex to display any match, not restricted to word boundaries.
+ let searchElement;
+ let searchButton;
+ let searchInput;
-function Hilitor(id, tag)
-{
+ let matchedSlides;
+ let currentMatchedIndex;
+ let searchboxDirty;
+ let hilitor;
- var targetNode = document.getElementById(id) || document.body;
- var hiliteTag = tag || "EM";
- var skipTags = new RegExp("^(?:" + hiliteTag + "|SCRIPT|FORM)$");
- var colors = ["#ff6", "#a0ffff", "#9f9", "#f99", "#f6f"];
- var wordColor = [];
- var colorIdx = 0;
- var matchRegex = "";
- var matchingSlides = [];
+ function render() {
- this.setRegex = function(input)
- {
- input = input.replace(/^[^\w]+|[^\w]+$/g, "").replace(/[^\w'-]+/g, "|");
- matchRegex = new RegExp("(" + input + ")","i");
- }
-
- this.getRegex = function()
- {
- return matchRegex.toString().replace(/^\/\\b\(|\)\\b\/i$/g, "").replace(/\|/g, " ");
- }
+ searchElement = document.createElement( 'div' );
+ searchElement.classList.add( 'searchbox' );
+ searchElement.style.position = 'absolute';
+ searchElement.style.top = '10px';
+ searchElement.style.right = '10px';
+ searchElement.style.zIndex = 10;
- // recursively apply word highlighting
- this.hiliteWords = function(node)
- {
- if(node == undefined || !node) return;
- if(!matchRegex) return;
- if(skipTags.test(node.nodeName)) return;
-
- if(node.hasChildNodes()) {
- for(var i=0; i < node.childNodes.length; i++)
- this.hiliteWords(node.childNodes[i]);
- }
- if(node.nodeType == 3) { // NODE_TEXT
- if((nv = node.nodeValue) && (regs = matchRegex.exec(nv))) {
- //find the slide's section element and save it in our list of matching slides
- var secnode = node;
- while (secnode != null && secnode.nodeName != 'SECTION') {
- secnode = secnode.parentNode;
- }
+ //embedded base64 search icon Designed by Sketchdock - http://www.sketchdock.com/:
+ searchElement.innerHTML = `<input type="search" class="searchinput" placeholder="Search..." style="vertical-align: top;"/>
+ </span>`;
- var slideIndex = Reveal.getIndices(secnode);
- var slidelen = matchingSlides.length;
- var alreadyAdded = false;
- for (var i=0; i < slidelen; i++) {
- if ( (matchingSlides[i].h === slideIndex.h) && (matchingSlides[i].v === slideIndex.v) ) {
- alreadyAdded = true;
- }
- }
- if (! alreadyAdded) {
- matchingSlides.push(slideIndex);
- }
+ searchInput = searchElement.querySelector( '.searchinput' );
+ searchInput.style.width = '240px';
+ searchInput.style.fontSize = '14px';
+ searchInput.style.padding = '4px 6px';
+ searchInput.style.color = '#000';
+ searchInput.style.background = '#fff';
+ searchInput.style.borderRadius = '2px';
+ searchInput.style.border = '0';
+ searchInput.style.outline = '0';
+ searchInput.style.boxShadow = '0 2px 18px rgba(0, 0, 0, 0.2)';
+ searchInput.style['-webkit-appearance'] = 'none';
- if(!wordColor[regs[0].toLowerCase()]) {
- wordColor[regs[0].toLowerCase()] = colors[colorIdx++ % colors.length];
- }
+ deck.getRevealElement().appendChild( searchElement );
- var match = document.createElement(hiliteTag);
- match.appendChild(document.createTextNode(regs[0]));
- match.style.backgroundColor = wordColor[regs[0].toLowerCase()];
- match.style.fontStyle = "inherit";
- match.style.color = "#000";
+ // searchButton.addEventListener( 'click', function(event) {
+ // doSearch();
+ // }, false );
- var after = node.splitText(regs.index);
- after.nodeValue = after.nodeValue.substring(regs[0].length);
- node.parentNode.insertBefore(match, after);
+ searchInput.addEventListener( 'keyup', function( event ) {
+ switch (event.keyCode) {
+ case 13:
+ event.preventDefault();
+ doSearch();
+ searchboxDirty = false;
+ break;
+ default:
+ searchboxDirty = true;
}
- }
- };
-
- // remove highlighting
- this.remove = function()
- {
- var arr = document.getElementsByTagName(hiliteTag);
- while(arr.length && (el = arr[0])) {
- el.parentNode.replaceChild(el.firstChild, el);
- }
- };
+ }, false );
- // start highlighting at target node
- this.apply = function(input)
- {
- if(input == undefined || !input) return;
- this.remove();
- this.setRegex(input);
- this.hiliteWords(targetNode);
- return matchingSlides;
- };
+ closeSearch();
-}
+ }
function openSearch() {
- //ensure the search term input dialog is visible and has focus:
- var inputboxdiv = document.getElementById("searchinputdiv");
- var inputbox = document.getElementById("searchinput");
- inputboxdiv.style.display = "inline";
- inputbox.focus();
- inputbox.select();
+ if( !searchElement ) render();
+
+ searchElement.style.display = 'inline';
+ searchInput.focus();
+ searchInput.select();
}
function closeSearch() {
- var inputboxdiv = document.getElementById("searchinputdiv");
- inputboxdiv.style.display = "none";
- if(myHilitor) myHilitor.remove();
+ if( !searchElement ) render();
+
+ searchElement.style.display = 'none';
+ if(hilitor) hilitor.remove();
}
function toggleSearch() {
- var inputboxdiv = document.getElementById("searchinputdiv");
- if (inputboxdiv.style.display !== "inline") {
+ if( !searchElement ) render();
+
+ if (searchElement.style.display !== 'inline') {
openSearch();
}
else {
@@ -136,16 +95,16 @@ function Hilitor(id, tag)
function doSearch() {
//if there's been a change in the search term, perform a new search:
if (searchboxDirty) {
- var searchstring = document.getElementById("searchinput").value;
+ var searchstring = searchInput.value;
if (searchstring === '') {
- if(myHilitor) myHilitor.remove();
+ if(hilitor) hilitor.remove();
matchedSlides = null;
}
else {
//find the keyword amongst the slides
- myHilitor = new Hilitor("slidecontent");
- matchedSlides = myHilitor.apply(searchstring);
+ hilitor = new Hilitor("slidecontent");
+ matchedSlides = hilitor.apply(searchstring);
currentMatchedIndex = 0;
}
}
@@ -156,52 +115,107 @@ function Hilitor(id, tag)
currentMatchedIndex = 0;
}
if (matchedSlides.length > currentMatchedIndex) {
- Reveal.slide(matchedSlides[currentMatchedIndex].h, matchedSlides[currentMatchedIndex].v);
+ deck.slide(matchedSlides[currentMatchedIndex].h, matchedSlides[currentMatchedIndex].v);
currentMatchedIndex++;
}
}
}
- var dom = {};
- dom.wrapper = document.querySelector( '.reveal' );
-
- if( !dom.wrapper.querySelector( '.searchbox' ) ) {
- var searchElement = document.createElement( 'div' );
- searchElement.id = "searchinputdiv";
- searchElement.classList.add( 'searchdiv' );
- searchElement.style.position = 'absolute';
- searchElement.style.top = '10px';
- searchElement.style.right = '10px';
- searchElement.style.zIndex = 10;
- //embedded base64 search icon Designed by Sketchdock - http://www.sketchdock.com/:
- searchElement.innerHTML = '<span><input type="search" id="searchinput" class="searchinput" style="vertical-align: top;"/><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJiSURBVHjatFZNaxNBGH5md+Mmu92NVdKDRipSAyqCghgQD4L4cRe86UUtAQ+eFCxoa4/25EXBFi8eBE+eRPoDhB6KgiiixdAPCEkx2pjvTXadd9yNsflwuyUDD/O+u8PzzDPvzOwyx3EwyCZhwG3gAkp7MnpjgbopjsltcD4gjuXZZKeAR348MYLYTm3LzOs/y3j3JTfZxgXWXmTuwPHIc4VmoOmv5IrI53+AO2DdHLjkDWQ3GoEEVFXtXQOvkSnPWcyUceviLhwbDYv8/XIVj97kse7TodLvZXxYxrPUHkQ1ufXs3FEdybEIxucySOesoNvUgWU1cP3MkCBfTFdw9fGaAMVmRELq7LBw2Q3/FaAxxWIRpw+ZIr/7IouPqzUBiqmdHAv7EuhRAwf1er2Vy4x1jW3b2d5Jfvu5IPp7l2LYbcgCFFNb+FoJ7oBqEAqFMPNqFcmEgVMJDfMT+1tvN0pNjERlMS6QA5pFOKxiKVPFhakPeL3It+WGJUDxt2wFR+JhzI7v5ctkd8DXOZAkCYYxhO+lKm4+Xfqz/rIixBuNBl7eOYzkQQNzqX249mRl6zUgEcYkaJrGhUwBinVdh6IouPzwE6/DL5w4oLkH8y981aDf+uq6hlKpJESiUdNfDZi7/ehG9K6KfiA3pml0PLcsq+cSMTj2NL9ukc4UOmz7AZ3+crkC4mHujFvXNaMFB3bEr8xPS6p5O+jXxq4VZtaen7/PwzrntjcLUE0iHPS1Ud1cdiEJl/8WivZk0wXd7zWOMkeF8s0CcAmkNrC2nvXZDbbbN73ccYnZoH9bfgswAFzAe9/h3dbKAAAAAElFTkSuQmCC" id="searchbutton" class="searchicon" style="vertical-align: top; margin-top: -1px;"/></span>';
- dom.wrapper.appendChild( searchElement );
- }
+ // Original JavaScript code by Chirp Internet: www.chirp.com.au
+ // Please acknowledge use of this code by including this header.
+ // 2/2013 jon: modified regex to display any match, not restricted to word boundaries.
+ function Hilitor(id, tag) {
- document.getElementById( 'searchbutton' ).addEventListener( 'click', function(event) {
- doSearch();
- }, false );
+ var targetNode = document.getElementById(id) || document.body;
+ var hiliteTag = tag || "EM";
+ var skipTags = new RegExp("^(?:" + hiliteTag + "|SCRIPT|FORM)$");
+ var colors = ["#ff6", "#a0ffff", "#9f9", "#f99", "#f6f"];
+ var wordColor = [];
+ var colorIdx = 0;
+ var matchRegex = "";
+ var matchingSlides = [];
- document.getElementById( 'searchinput' ).addEventListener( 'keyup', function( event ) {
- switch (event.keyCode) {
- case 13:
- event.preventDefault();
- doSearch();
- searchboxDirty = false;
- break;
- default:
- searchboxDirty = true;
+ this.setRegex = function(input)
+ {
+ input = input.replace(/^[^\w]+|[^\w]+$/g, "").replace(/[^\w'-]+/g, "|");
+ matchRegex = new RegExp("(" + input + ")","i");
}
- }, false );
- document.addEventListener( 'keydown', function( event ) {
- if( event.key == "F" && (event.ctrlKey || event.metaKey) ) { //Control+Shift+f
- event.preventDefault();
- toggleSearch();
+ this.getRegex = function()
+ {
+ return matchRegex.toString().replace(/^\/\\b\(|\)\\b\/i$/g, "").replace(/\|/g, " ");
}
- }, false );
- closeSearch();
+ // recursively apply word highlighting
+ this.hiliteWords = function(node)
+ {
+ if(node == undefined || !node) return;
+ if(!matchRegex) return;
+ if(skipTags.test(node.nodeName)) return;
+
+ if(node.hasChildNodes()) {
+ for(var i=0; i < node.childNodes.length; i++)
+ this.hiliteWords(node.childNodes[i]);
+ }
+ if(node.nodeType == 3) { // NODE_TEXT
+ var nv, regs;
+ if((nv = node.nodeValue) && (regs = matchRegex.exec(nv))) {
+ //find the slide's section element and save it in our list of matching slides
+ var secnode = node;
+ while (secnode != null && secnode.nodeName != 'SECTION') {
+ secnode = secnode.parentNode;
+ }
+
+ var slideIndex = deck.getIndices(secnode);
+ var slidelen = matchingSlides.length;
+ var alreadyAdded = false;
+ for (var i=0; i < slidelen; i++) {
+ if ( (matchingSlides[i].h === slideIndex.h) && (matchingSlides[i].v === slideIndex.v) ) {
+ alreadyAdded = true;
+ }
+ }
+ if (! alreadyAdded) {
+ matchingSlides.push(slideIndex);
+ }
+
+ if(!wordColor[regs[0].toLowerCase()]) {
+ wordColor[regs[0].toLowerCase()] = colors[colorIdx++ % colors.length];
+ }
+
+ var match = document.createElement(hiliteTag);
+ match.appendChild(document.createTextNode(regs[0]));
+ match.style.backgroundColor = wordColor[regs[0].toLowerCase()];
+ match.style.fontStyle = "inherit";
+ match.style.color = "#000";
+
+ var after = node.splitText(regs.index);
+ after.nodeValue = after.nodeValue.substring(regs[0].length);
+ node.parentNode.insertBefore(match, after);
+ }
+ }
+ };
+
+ // remove highlighting
+ this.remove = function()
+ {
+ var arr = document.getElementsByTagName(hiliteTag);
+ var el;
+ while(arr.length && (el = arr[0])) {
+ el.parentNode.replaceChild(el.firstChild, el);
+ }
+ };
+
+ // start highlighting at target node
+ this.apply = function(input)
+ {
+ if(input == undefined || !input) return;
+ this.remove();
+ this.setRegex(input);
+ this.hiliteWords(targetNode);
+ return matchingSlides;
+ };
+
+ }
return {
@@ -209,13 +223,21 @@ function Hilitor(id, tag)
init: reveal => {
- reveal.registerKeyboardShortcut( 'CTRL + Shift + F', 'Search' );
+ deck = reveal;
+ deck.registerKeyboardShortcut( 'CTRL + Shift + F', 'Search' );
+
+ document.addEventListener( 'keydown', function( event ) {
+ if( event.key == "F" && (event.ctrlKey || event.metaKey) ) { //Control+Shift+f
+ event.preventDefault();
+ toggleSearch();
+ }
+ }, false );
},
open: openSearch
}
-})();
+};
-export default () => Plugin; \ No newline at end of file
+export default Plugin; \ No newline at end of file