convert plugins to ES modules, transpile es5 versions backwards compatibility
This commit is contained in:
1 parent
9522357349
commit
a55cd813be
36 files changed
+3018
-886
No files matched your search
@@ -410,11 +410,17 @@ Reveal.on( 'customevent', function() {
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="module" src="js/index.js"></script>
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
|
||||||
|
import Reveal from '/js/reveal.js';
|
||||||
|
import Zoom from '/plugin/zoom/zoom.js';
|
||||||
|
import Notes from '/plugin/notes/notes.js';
|
||||||
|
import Search from '/plugin/search/search.js';
|
||||||
|
import Markdown from '/plugin/markdown/markdown.js';
|
||||||
|
import Highlight from '/plugin/highlight/highlight.js';
|
||||||
|
|
||||||
// More info https://github.com/hakimel/reveal.js#configuration
|
// More info https://github.com/hakimel/reveal.js#configuration
|
||||||
Reveal.initialize({
|
let deck = new Reveal( document.querySelector( '.reveal' ), {
|
||||||
controls: true,
|
controls: true,
|
||||||
progress: true,
|
progress: true,
|
||||||
center: true,
|
center: true,
|
||||||
@@ -423,16 +429,11 @@ Reveal.on( 'customevent', function() {
|
|||||||
transition: 'slide', // none/fade/slide/convex/concave/zoom
|
transition: 'slide', // none/fade/slide/convex/concave/zoom
|
||||||
|
|
||||||
// More info https://github.com/hakimel/reveal.js#dependencies
|
// More info https://github.com/hakimel/reveal.js#dependencies
|
||||||
dependencies: [
|
dependencies: [ Zoom, Notes, Search, Markdown, Highlight ]
|
||||||
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
|
|
||||||
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
|
|
||||||
{ src: 'plugin/highlight/highlight.js' },
|
|
||||||
{ src: 'plugin/search/search.js', async: true },
|
|
||||||
{ src: 'plugin/zoom-js/zoom.js', async: true },
|
|
||||||
{ src: 'plugin/notes/notes.js', async: true }
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
deck.initialize();
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
!function(e){var t={};function r(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(a,i,function(t){return e[t]}.bind(null,i));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t){function r(e){return(r="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})(e)}!function(e,t){"use strict";function a(r){try{var a=t.querySelectorAll("code.hljs,code.nohighlight");for(var n in a)a.hasOwnProperty(n)&&i(a[n],r)}catch(t){e.console.error("LineNumbers error: ",t)}}function i(e,t){"object"==r(e)&&function(e){e()}((function(){e.innerHTML=n(e,t)}))}function n(e,t){var r=(t=t||{singleLine:!1}).singleLine?0:1;return function e(t){var r=t.childNodes;for(var a in r)if(r.hasOwnProperty(a)){var i=r[a];l(i.textContent)>0&&(i.childNodes.length>0?e(i):o(i.parentNode))}}(e),function(e,t){var r=s(e);if(""===r[r.length-1].trim()&&r.pop(),r.length>t){for(var a="",i=0,n=r.length;i<n;i++)a+=c('<tr><td class="{0}"><div class="{1} {2}" {3}="{5}"></div></td><td class="{4}"><div class="{1}">{6}</div></td></tr>',[u,d,m,S,p,i+1,r[i].length>0?r[i]:" "]);return c('<table class="{0}">{1}</table>',[_,a])}return e}(e.innerHTML,r)}function o(e){var t=e.className;if(/hljs-/.test(t)){for(var r=s(e.innerHTML),a=0,i="";a<r.length;a++){i+=c('<span class="{0}">{1}</span>\n',[t,r[a].length>0?r[a]:" "])}e.innerHTML=i.trim()}}function s(e){return 0===e.length?[]:e.split(E)}function l(e){return(e.trim().match(E)||[]).length}function c(e,t){return e.replace(/\{(\d+)\}/g,(function(e,r){return t[r]?t[r]:e}))}var _="hljs-ln",d="hljs-ln-line",p="hljs-ln-code",u="hljs-ln-numbers",m="hljs-ln-n",S="data-line-number",E=/\r\n|\r|\n/g;e.hljs?(e.hljs.initLineNumbersOnLoad=function(r){"interactive"===t.readyState||"complete"===t.readyState?a(r):e.addEventListener("DOMContentLoaded",(function(){a(r)}))},e.hljs.lineNumbersBlock=i,e.hljs.lineNumbersValue=function(e,t){if("string"==typeof e){var r=document.createElement("code");return r.innerHTML=e,n(r,t)}},function(){var e=t.createElement("style");e.type="text/css",e.innerHTML=c(".{0}{border-collapse:collapse}.{0} td{padding:0}.{1}:before{content:attr({2})}",[_,m,S]),t.getElementsByTagName("head")[0].appendChild(e)}()):e.console.error("highlight.js not detected!")}(window,document)},function(e,t,r){"use strict";function a(e){return(a="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})(e)}/*! highlight.js v9.18.0 | BSD3 License | git.io/hljslicense */r.r(t),function(e){var t="object"==("undefined"==typeof window?"undefined":a(window))&&window||"object"==("undefined"==typeof self?"undefined":a(self))&&self;"undefined"==typeof exports||exports.nodeType?t&&(t.hljs=e({}),"function"==typeof define&&r(0)&&define([],(function(){return t.hljs}))):e(exports)}((function(e){var t=[],r=Object.keys,i={},n={},o=!0,s=/^(no-?highlight|plain|text)$/i,l=/\blang(?:uage)?-([\w-]+)\b/i,c=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,_={case_insensitive:"cI",lexemes:"l",contains:"c",keywords:"k",subLanguage:"sL",className:"cN",begin:"b",beginKeywords:"bK",end:"e",endsWithParent:"eW",illegal:"i",excludeBegin:"eB",excludeEnd:"eE",returnBegin:"rB",returnEnd:"rE",variants:"v",IDENT_RE:"IR",UNDERSCORE_IDENT_RE:"UIR",NUMBER_RE:"NR",C_NUMBER_RE:"CNR",BINARY_NUMBER_RE:"BNR",RE_STARTERS_RE:"RSR",BACKSLASH_ESCAPE:"BE",APOS_STRING_MODE:"ASM",QUOTE_STRING_MODE:"QSM",PHRASAL_WORDS_MODE:"PWM",C_LINE_COMMENT_MODE:"CLCM",C_BLOCK_COMMENT_MODE:"CBCM",HASH_COMMENT_MODE:"HCM",NUMBER_MODE:"NM",C_NUMBER_MODE:"CNM",BINARY_NUMBER_MODE:"BNM",CSS_NUMBER_MODE:"CSSNM",REGEXP_MODE:"RM",TITLE_MODE:"TM",UNDERSCORE_TITLE_MODE:"UTM",COMMENT:"C",beginRe:"bR",endRe:"eR",illegalRe:"iR",lexemesRe:"lR",terminators:"t",terminator_end:"tE"},d="</span>",p="Could not find the language '{}', did you forget to load/include a language module?",u={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},m="of and for in not or if then".split(" ");function S(e){return e.replace(/&/g,"&").replace(/</g,"<").replacLine truncated
|
||||||
|
/*!
|
||||||
|
* reveal.js plugin that adds syntax highlight support.
|
||||||
|
*/
|
||||||
|
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)),t.escapeHTML&&!e.hasAttribute("data-noescape")&&(e.innerHTML=e.innerHTML.replace(/</g,"<").replace(/>/g,">")),e.addEventListener("focusout",(function(e){i.highlightBlock(e.currentTarget)}),!1),t.highlightOnLoad&&n.highlightBlock(e)})),e.on("pdf-ready",(function(){[].slice.call(document.querySelectorAll(".reveal pre code[data-line-numbers].current-fragment")).forEach((function(e){n.scrollHighlightedLineIntoView(e,{},!0)}))}))},highlightBlock:function(e){if(i.highlightBlock(e),0!==e.innerHTML.trim().length&&e.hasAttribute("data-line-numbers")){i.lineNumbersBlock(e,{singleLine:!0});var t={currentBlock:e},r=n.deserializeHighlightSteps(e.getAttribute("data-line-numbers"));if(r.length>1){var a=parseInt(e.getAttribute("data-fragment-index"),10);("number"!=typeof a||isNaN(a))&&(a=null),r.slice(1).forEach((function(r){var i=e.cloneNode(!0);i.setAttribute("data-line-numbers",n.serializeHighlightSteps([r])),i.classList.add("fragment"),e.parentNode.appendChild(i),n.highlightLines(i),"number"==typeof a?(i.setAttribute("data-fragment-index",a),a+=1):i.removeAttribute("data-fragment-index"),i.addEventListener("visible",n.scrollHighlightedLineIntoView.bind(n,i,t)),i.addEventListener("hidden",n.scrollHighlightedLineIntoView.bind(n,i.previousSibling,t))})),e.removeAttribute("data-fragment-index"),e.setAttribute("data-line-numbers",n.serializeHighlightSteps([r[0]]))}var o="function"==typeof e.closest?e.closest("section:not(.stack)"):null;if(o){o.addEventListener("visible",(function r(){n.scrollHighlightedLineIntoView(e,t,!0),o.removeEventListener("visible",r)}))}n.highlightLines(e)}},scrollHighlightedLineIntoView:function(e,t,r){cancelAnimationFrame(t.animationFrameID),t.currentBlock&&(e.scrollTop=t.currentBlock.scrollTop),t.currentBlock=e;var a=this.getHighlightedLineBounds(e),i=e.offsetHeight,o=getComputedStyle(e);i-=parseInt(o.paddingTop)+parseInt(o.paddingBottom);var s=e.scrollTop,l=a.top+(Math.min(a.bottom-a.top,i)-i)/2,c=e.querySelector(".hljs-ln");if(c&&(l+=c.offsetTop-parseInt(o.paddingTop)),l=Math.max(Math.min(l,e.scrollHeight-i),0),!0===r||s===l)e.scrollTop=l;else{if(e.scrollHeight<=i)return;var _=0;!function r(){_=Math.min(_+.02,1),e.scrollTop=s+(l-s)*n.easeInOutQuart(_),_<1&&(t.animationFrameID=requestAnimationFrame(r))}()}},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,t){var r=n.deserializeHighlightSteps(t||e.getAttribute("data-line-numbers"));r.length&&r[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(n.HIGHLIGHT_STEP_DELIMITER)).map((function(e){return e.split(n.HIGHLIGHT_LINE_DELIMITER).map((function(e){if(/^[\d-]+$/.test(e)){e=e.split(n.HIGHLIGHT_LINE_RANGE_DELIMITER);var t=parseInt(e[0],10),r=parseInt(e[1],10);return isNaN(r)?{start:t}:{start:t,end:r}}return{}}))}))},serializeHighlightSteps:function(e){return e.map((function(e){return e.map((function(e){return"number"==typeof e.end?e.start+n.HIGHLIGHT_LINE_RANGE_DELIMITER+e.end:"number"==typeof e.start?e.start:""})).join(n.HIGHLIGHT_LINE_DELIMITER)})).join(n.HIGHLIGHT_STEP_DELIMITER)}},o=n;Reveal.registerPlugin(o)}]);
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var s=t[r]={i:r,l:!1,exports:{}};return e[r].call(s.exports,s,s.exports,n),s.l=!0,s.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(r,s,function(t){return e[t]}.bind(null,s));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}({3:function(e,t,n){"use strict";function r(e){return(r="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})(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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 a(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}n.r(t);var l=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}}})),o=(l.defaults,l.getDefaults,l.changeDefaults,/[&<>"']/),u=/[&<>"']/g,c=/[<>"']|&(?!#?\w+;)/,h=/[<>"']|&(?!#?\w+;)/g,p={"&":"&","<":"<",">":">",'"':""","'":"'"},g=function(e){return p[e]};var f=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function d(e){return e.replace(f,(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 b=/(^|[^\[])\^/g;var k=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;var x={},y=/^[^:]+:\/*[^/]*$/,v=/^([^:]+:)[\s\S]*$/,w=/^([^:]+:\/*[^/]*)[\s\S]*$/;function _(e,t){x[" "+e]||(y.test(e)?x[" "+e]=e+"/":x[" "+e]=S(e,"/",!0));var n=-1===(e=x[" "+e]).indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(v,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(w,"$1")+t:e+t}function S(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 A=function(e,t){if(t){if(o.test(e))return e.replace(u,g)}else if(c.test(e))return e.replace(h,g);return e},$=d,R=function(e,t,n){if(e){var r;try{r=decodeURIComponent(d(n)).replace(k,"").toLowerCase()}catch(e){return null}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return null}t&&!m.test(n)&&(n=_(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(e){return null}return n},z=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},T=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},E=S,O=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},L=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")},q={exec:function(){}},P=function(e,t){e=e.source||e,t=t||"";var n={replace:function(t,r){return r=(r=r.source||r).replace(b,"$1"),e=e.replace(t,r),n},getRegex:function(){return new RegExp(e,t)}};return n},C=z,I={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]*?Line truncated
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}({7:function(e,t,n){"use strict";n.r(t);var r=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 r(e,t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}return{id:"math",init:function(a){r(e,n),r(e.tex2jax,n.tex2jax),e.mathjax=e.config=null,function(e,t){var n=document.querySelector("head"),r=document.createElement("script");r.type="text/javascript",r.src=e;var a=function(){"function"==typeof t&&(t.call(),t=null)};r.onload=a,r.onreadystatechange=function(){"loaded"===this.readyState&&a()},n.appendChild(r)}(t,(function(){MathJax.Hub.Config(e),MathJax.Hub.Queue(["Typeset",MathJax.Hub]),MathJax.Hub.Queue(a.layout),a.on("slidechanged",(function(e){MathJax.Hub.Queue(["Typeset",MathJax.Hub,e.currentSlide])}))}))}}}();Reveal.registerPlugin(r)}});
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=5)}({5:function(e,t,n){"use strict";n.r(t);var o=function(){var e,t=null;function n(n){var o;!t||t.closed?(n||(n="plugin/notes/notes.html"),(t=window.open(n,"reveal.js - Notes","width=1100,height=700"))?(o=setInterval((function(){t.postMessage(JSON.stringify({namespace:"reveal-notes",type:"connect",url:window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,state:e.getState()}),"*")}),500),window.addEventListener("message",(function(n){var a,i,s,l,u=JSON.parse(n.data);u&&"reveal-notes"===u.namespace&&"connected"===u.type&&(clearInterval(o),e.on("slidechanged",r),e.on("fragmentshown",r),e.on("fragmenthidden",r),e.on("overviewhidden",r),e.on("overviewshown",r),e.on("paused",r),e.on("resumed",r),r()),u&&"reveal-notes"===u.namespace&&"call"===u.type&&(a=u.methodName,i=u.arguments,s=u.callId,l=e[a].apply(e,i),t.postMessage(JSON.stringify({namespace:"reveal-notes",type:"return",result:l,callId:s}),"*"))}))):alert("Speaker view popup failed to open. Please make sure popups are allowed and reopen the speaker view.")):t.focus();function r(n){var o=e.getCurrentSlide(),r=o.querySelector("aside.notes"),a=o.querySelector(".current-fragment"),i={namespace:"reveal-notes",type:"state",notes:"",markdown:!1,whitespace:"normal",state:e.getState()};if(o.hasAttribute("data-notes")&&(i.notes=o.getAttribute("data-notes"),i.whitespace="pre-wrap"),a){var s=a.querySelector("aside.notes");s?r=s:a.hasAttribute("data-notes")&&(i.notes=a.getAttribute("data-notes"),i.whitespace="pre-wrap",r=null)}r&&(i.notes=r.innerHTML,i.markdown="string"==typeof r.getAttribute("data-markdown")),t.postMessage(JSON.stringify(i),"*")}}return{id:"notes",init:function(t){e=t,/receiver/i.test(window.location.search)||(null!==window.location.search.match(/(\?|\&)notes/gi)&&n(),e.addKeyBinding({keyCode:83,key:"S",description:"Speaker notes view"},(function(){n()})))},open:n}}();Reveal.registerPlugin(o)}});
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}({4:function(e,t,n){"use strict";n.r(t);var r=function(){var e,t,n,r;function i(e,t){var n=document.getElementById(e)||document.body,r=t||"EM",i=new RegExp("^(?:"+r+"|SCRIPT|FORM)$"),o=["#ff6","#a0ffff","#9f9","#f99","#f6f"],l=[],a=0,c="",d=[];this.setRegex=function(e){e=e.replace(/^[^\w]+|[^\w]+$/g,"").replace(/[^\w'-]+/g,"|"),c=new RegExp("("+e+")","i")},this.getRegex=function(){return c.toString().replace(/^\/\\b\(|\)\\b\/i$/g,"").replace(/\|/g," ")},this.hiliteWords=function(e){if(null!=e&&e&&c&&!i.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=c.exec(nv))){for(var n=e;null!=n&&"SECTION"!=n.nodeName;)n=n.parentNode;var u=Reveal.getIndices(n),s=d.length,p=!1;for(t=0;t<s;t++)d[t].h===u.h&&d[t].v===u.v&&(p=!0);p||d.push(u),l[regs[0].toLowerCase()]||(l[regs[0].toLowerCase()]=o[a++%o.length]);var f=document.createElement(r);f.appendChild(document.createTextNode(regs[0])),f.style.backgroundColor=l[regs[0].toLowerCase()],f.style.fontStyle="inherit",f.style.color="#000";var g=e.splitText(regs.index);g.nodeValue=g.nodeValue.substring(regs[0].length),e.parentNode.insertBefore(f,g)}}},this.remove=function(){for(var e=document.getElementsByTagName(r);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),d}}function o(){var e=document.getElementById("searchinputdiv"),t=document.getElementById("searchinput");e.style.display="inline",t.focus(),t.select()}function l(){document.getElementById("searchinputdiv").style.display="none",r&&r.remove()}function a(){if(n){var o=document.getElementById("searchinput").value;""===o?(r&&r.remove(),e=null):(r=new i("slidecontent"),e=r.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 c={};if(c.wrapper=document.querySelector(".reveal"),!c.wrapper.querySelector(".searchbox")){var d=document.createElement("div");d.id="searchinputdiv",d.classList.add("searchdiv"),d.style.position="absolute",d.style.top="10px",d.style.right="10px",d.style.zIndex=10,d.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>',c.wrapper.appendChild(d)}return document.getElementById("searchbutton").addEventListener("click",(function(e){a()}),!1),document.getElementById("searchinput").addEventListener("keyup",(function(e){switch(e.keyCode){case 13:e.preventDefault(),a(),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():l())}),!1),l(),{id:"search",init:function(e){e.registerKeyboardShortcut("CTRL + Shift + F","Search")},open:o}}();Reveal.registerPlugin(r)}});
|
||||||
Vendored
+11
@@ -0,0 +1,11 @@
|
|||||||
|
!function(e){var t={};function o(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,o),i.l=!0,i.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=6)}({6:function(e,t,o){"use strict";o.r(t);
|
||||||
|
/*!
|
||||||
|
* reveal.js Zoom plugin
|
||||||
|
*/var n={id:"zoom",init:function(e){e.getRevealElement().addEventListener("mousedown",(function(t){var o=/Linux/.test(window.navigator.platform)?"ctrl":"alt",n=(e.getConfig().zoomKey?e.getConfig().zoomKey:o)+"Key",r=e.getConfig().zoomLevel?e.getConfig().zoomLevel:2;t[n]&&!e.isOverview()&&(t.preventDefault(),i.to({x:t.clientX,y:t.clientY,scale:r,pan:!1}))}))}},i=function(){var e=1,t=0,o=0,n=-1,r=-1,d="WebkitTransform"in document.body.style||"MozTransform"in document.body.style||"msTransform"in document.body.style||"OTransform"in document.body.style||"transform"in document.body.style;function s(t,o){var n=u();if(t.width=t.width||1,t.height=t.height||1,t.x-=(window.innerWidth-t.width*o)/2,t.y-=(window.innerHeight-t.height*o)/2,d)if(1===o)document.body.style.transform="",document.body.style.OTransform="",document.body.style.msTransform="",document.body.style.MozTransform="",document.body.style.WebkitTransform="";else{var i=n.x+"px "+n.y+"px",r="translate("+-t.x+"px,"+-t.y+"px) scale("+o+")";document.body.style.transformOrigin=i,document.body.style.OTransformOrigin=i,document.body.style.msTransformOrigin=i,document.body.style.MozTransformOrigin=i,document.body.style.WebkitTransformOrigin=i,document.body.style.transform=r,document.body.style.OTransform=r,document.body.style.msTransform=r,document.body.style.MozTransform=r,document.body.style.WebkitTransform=r}else 1===o?(document.body.style.position="",document.body.style.left="",document.body.style.top="",document.body.style.width="",document.body.style.height="",document.body.style.zoom=""):(document.body.style.position="relative",document.body.style.left=-(n.x+t.x)/o+"px",document.body.style.top=-(n.y+t.y)/o+"px",document.body.style.width=100*o+"%",document.body.style.height=100*o+"%",document.body.style.zoom=o);e=o,document.documentElement.classList&&(1!==e?document.documentElement.classList.add("zoomed"):document.documentElement.classList.remove("zoomed"))}function l(){var n=.12*window.innerWidth,i=.12*window.innerHeight,r=u();o<i?window.scroll(r.x,r.y-14/e*(1-o/i)):o>window.innerHeight-i&&window.scroll(r.x,r.y+(1-(window.innerHeight-o)/i)*(14/e)),t<n?window.scroll(r.x-14/e*(1-t/n),r.y):t>window.innerWidth-n&&window.scroll(r.x+(1-(window.innerWidth-t)/n)*(14/e),r.y)}function u(){return{x:void 0!==window.scrollX?window.scrollX:window.pageXOffset,y:void 0!==window.scrollY?window.scrollY:window.pageYOffset}}return d&&(document.body.style.transition="transform 0.8s ease",document.body.style.OTransition="-o-transform 0.8s ease",document.body.style.msTransition="-ms-transform 0.8s ease",document.body.style.MozTransition="-moz-transform 0.8s ease",document.body.style.WebkitTransition="-webkit-transform 0.8s ease"),document.addEventListener("keyup",(function(t){1!==e&&27===t.keyCode&&i.out()})),document.addEventListener("mousemove",(function(n){1!==e&&(t=n.clientX,o=n.clientY)})),{to:function(t){if(1!==e)i.out();else{if(t.x=t.x||0,t.y=t.y||0,t.element){var o=t.element.getBoundingClientRect();t.x=o.left-20,t.y=o.top-20,t.width=o.width+40,t.height=o.height+40}void 0!==t.width&&void 0!==t.height&&(t.scale=Math.max(Math.min(window.innerWidth/t.width,window.innerHeight/t.height),1)),t.scale>1&&(t.x*=t.scale,t.y*=t.scale,s(t,t.scale),!1!==t.pan&&(n=setTimeout((function(){r=setInterval(l,1e3/60)}),800)))}},out:function(){clearTimeout(n),clearInterval(r),s({x:0,y:0},1),e=1},magnify:function(e){this.to(e)},reset:function(){this.out()},zoomLevel:function(){return e}}}();
|
||||||
|
/*!
|
||||||
|
* zoom.js 0.3 (modified for use with reveal.js)
|
||||||
|
* http://lab.hakim.se/zoom-js
|
||||||
|
* MIT licensed
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011-2014 Hakim El Hattab, http://hakim.se
|
||||||
|
*/Reveal.registerPlugin(n)}});
|
||||||
Vendored
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
/*!
|
/*!
|
||||||
* reveal.js 4.0.0-dev (Wed Apr 08 2020)
|
* reveal.js 4.0.0-dev (Wed Apr 15 2020)
|
||||||
* https://revealjs.com
|
* https://revealjs.com
|
||||||
* MIT licensed
|
* MIT licensed
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 Hakim El Hattab, https://hakim.se
|
* Copyright (C) 2020 Hakim El Hattab, https://hakim.se
|
||||||
*/
|
*/
|
||||||
!function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(i,a,function(t){return e[t]}.bind(null,a));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";n.r(t);var i=/registerPlugin|registerKeyboardShortcut|addKeyBinding|addEventListener/,a=/fade-(down|up|right|left|out|in-then-out|in-then-semi-out)|semi-fade-out|current-visible|shrink|grow/,r=function(e,t){for(var n in t)e[n]=t[n];return e},o=function(e,t){return Array.from(e.querySelectorAll(t))},s=function(e){if("string"==typeof e){if("null"===e)return null;if("true"===e)return!0;if("false"===e)return!1;if(e.match(/^-?[\d\.]+$/))return parseFloat(e)}return e},l=function(e,t){e.style.transform=t},c=function(e,t){for(var n=e.parentNode;n;){var i=n.matches||n.matchesSelector||n.msMatchesSelector;if(i&&i.call(n,t))return n;n=n.parentNode}return null},u=function(e){var t=document.createElement("style");return t.type="text/css",e&&e.length>0&&(t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))),document.head.appendChild(t),t},d=function(){var e={};for(var t in location.search.replace(/[A-Z0-9]+?=([\w\.%-]*)/gi,(function(t){e[t.split("=").shift()]=t.split("=").pop()})),e){var n=e[t];e[t]=s(unescape(n))}return void 0!==e.dependencies&&delete e.dependencies,e},h=navigator.userAgent,v=document.createElement("div"),f=/(iphone|ipod|ipad|android)/gi.test(h)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,g=/chrome/i.test(h)&&!/edge/i.test(h),p=/android/gi.test(h),m="zoom"in v.style&&!f&&(g||/Version\/[\d\.]+.*Safari/.test(h)),y="function"==typeof window.history.replaceState&&!/PhantomJS/.test(h);function b(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var w=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.Reveal=t,this.startEmbeddedIframe=this.startEmbeddedIframe.bind(this)}var t,n,i;return t=e,(n=[{key:"shouldPreload",value:function(e){var t=this.Reveal.getConfig().preloadIframes;return"boolean"!=typeof t&&(t=e.hasAttribute("data-preload")),t}},{key:"load",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.style.display=this.Reveal.getConfig().display,o(e,"img[data-src], video[data-src], audio[data-src], iframe[data-src]").forEach((function(e){("IFRAME"!==e.tagName||t.shouldPreload(e))&&(e.setAttribute("src",e.getAttribute("data-src")),e.setAttribute("data-lazy-loaded",""),e.removeAttribute("data-src"))})),o(e,"video, audio").forEach((function(e){var t=0;o(e,"source[data-src]").forEach((function(e){e.setAttribute("src",e.getAttribute("data-src")),e.removeAttribute("data-src"),e.setAttribute("data-lazy-loaded",""),t+=1})),t>0&&e.load()}));var i=e.slideBackgroundElement;if(i){i.style.display="block";var a=e.slideBackgroundContentElement,r=e.getAttribute("data-background-iframe");if(!1===i.hasAttribute("data-loaded")){i.setAttribute("data-loaded","true");var s=e.getAttribute("data-background-image"),l=e.getAttribute("data-background-video"),c=e.hasAttribute("data-background-video-loop"),u=e.hasAttribute("data-background-video-muted");if(s)a.style.backgroundImage="url("+encodeURI(s)+")";else if(l&&!this.Reveal.isSpeakerNotes()){var d=document.createElement("video");c&&d.setAttribute("loop",""),u&&(d.muted=!0),f&&(d.muted=!0,d.autoplay=!0,d.setAttribute("playsinline","")),l.split(",").forEach((function(e){d.innerHTML+='<source src="'+e+'">'})),a.appendChild(d)}else if(r&&!0!==n.excludeIframes){var h=document.createElement("iframe");h.setAttribute("allowfullscreen",""),h.setAttribute("mozallowfullscreen",""),h.setAttribute("webkitallowfullscreen",""),h.setAttribute("allow","autoplay"),h.setAttribute("data-src",r),h.style.width="100%",h.style.height="100%",h.style.maxHeight="100%",h.style.maxWidth="100%",a.appendChild(h)}}var v=a.querySelector("iframe[data-src]");v&&this.shouldPreload(i)&&!/autoplay=(1|true|yes)/gi.test(r)&&v.getAttribute("src")!==r&&v.setAttribute("src",r)}}},{key:"unload",value:function(e){e.style.display="none";var t=this.Reveal.getSlideBackground(e);t&&(t.style.display="none",o(t,Line truncated
|
!function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(i,a,function(t){return e[t]}.bind(null,a));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";n.r(t);var i=/registerPlugin|registerKeyboardShortcut|addKeyBinding|addEventListener/,a=/fade-(down|up|right|left|out|in-then-out|in-then-semi-out)|semi-fade-out|current-visible|shrink|grow/,r=function(e,t){for(var n in t)e[n]=t[n];return e},o=function(e,t){return Array.from(e.querySelectorAll(t))},s=function(e){if("string"==typeof e){if("null"===e)return null;if("true"===e)return!0;if("false"===e)return!1;if(e.match(/^-?[\d\.]+$/))return parseFloat(e)}return e},l=function(e,t){e.style.transform=t},c=function(e,t){for(var n=e.parentNode;n;){var i=n.matches||n.matchesSelector||n.msMatchesSelector;if(i&&i.call(n,t))return n;n=n.parentNode}return null},u=function(e){var t=document.createElement("style");return t.type="text/css",e&&e.length>0&&(t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))),document.head.appendChild(t),t},d=function(){var e={};for(var t in location.search.replace(/[A-Z0-9]+?=([\w\.%-]*)/gi,(function(t){e[t.split("=").shift()]=t.split("=").pop()})),e){var n=e[t];e[t]=s(unescape(n))}return void 0!==e.dependencies&&delete e.dependencies,e},h=navigator.userAgent,v=document.createElement("div"),f=/(iphone|ipod|ipad|android)/gi.test(h)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,g=/chrome/i.test(h)&&!/edge/i.test(h),p=/android/gi.test(h),m="zoom"in v.style&&!f&&(g||/Version\/[\d\.]+.*Safari/.test(h)),y="function"==typeof window.history.replaceState&&!/PhantomJS/.test(h);function b(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var w=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.Reveal=t,this.startEmbeddedIframe=this.startEmbeddedIframe.bind(this)}var t,n,i;return t=e,(n=[{key:"shouldPreload",value:function(e){var t=this.Reveal.getConfig().preloadIframes;return"boolean"!=typeof t&&(t=e.hasAttribute("data-preload")),t}},{key:"load",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.style.display=this.Reveal.getConfig().display,o(e,"img[data-src], video[data-src], audio[data-src], iframe[data-src]").forEach((function(e){("IFRAME"!==e.tagName||t.shouldPreload(e))&&(e.setAttribute("src",e.getAttribute("data-src")),e.setAttribute("data-lazy-loaded",""),e.removeAttribute("data-src"))})),o(e,"video, audio").forEach((function(e){var t=0;o(e,"source[data-src]").forEach((function(e){e.setAttribute("src",e.getAttribute("data-src")),e.removeAttribute("data-src"),e.setAttribute("data-lazy-loaded",""),t+=1})),t>0&&e.load()}));var i=e.slideBackgroundElement;if(i){i.style.display="block";var a=e.slideBackgroundContentElement,r=e.getAttribute("data-background-iframe");if(!1===i.hasAttribute("data-loaded")){i.setAttribute("data-loaded","true");var s=e.getAttribute("data-background-image"),l=e.getAttribute("data-background-video"),c=e.hasAttribute("data-background-video-loop"),u=e.hasAttribute("data-background-video-muted");if(s)a.style.backgroundImage="url("+encodeURI(s)+")";else if(l&&!this.Reveal.isSpeakerNotes()){var d=document.createElement("video");c&&d.setAttribute("loop",""),u&&(d.muted=!0),f&&(d.muted=!0,d.autoplay=!0,d.setAttribute("playsinline","")),l.split(",").forEach((function(e){d.innerHTML+='<source src="'+e+'">'})),a.appendChild(d)}else if(r&&!0!==n.excludeIframes){var h=document.createElement("iframe");h.setAttribute("allowfullscreen",""),h.setAttribute("mozallowfullscreen",""),h.setAttribute("webkitallowfullscreen",""),h.setAttribute("allow","autoplay"),h.setAttribute("data-src",r),h.style.width="100%",h.style.height="100%",h.style.maxHeight="100%",h.style.maxWidth="100%",a.appendChild(h)}}var v=a.querySelector("iframe[data-src]");v&&this.shouldPreload(i)&&!/autoplay=(1|true|yes)/gi.test(r)&&v.getAttribute("src")!==r&&v.setAttribute("src",r)}}},{key:"unload",value:function(e){e.style.display="none";var t=this.Reveal.getSlideBackground(e);t&&(t.style.display="none",o(t,Line truncated
|
||||||
+18
@@ -42,6 +42,24 @@ gulp.task('js', () => gulp.src(['./js/index.js'])
|
|||||||
.pipe(rename('reveal.min.js'))
|
.pipe(rename('reveal.min.js'))
|
||||||
.pipe(gulp.dest('./dist')))
|
.pipe(gulp.dest('./dist')))
|
||||||
|
|
||||||
|
gulp.task('plugins', () => gulp.src(['./js/index.js'])
|
||||||
|
.pipe(webpack({
|
||||||
|
...require('./webpack.config.js'),
|
||||||
|
entry: {
|
||||||
|
'highlight': './plugin/highlight/highlight.es5',
|
||||||
|
'markdown': './plugin/markdown/markdown.es5',
|
||||||
|
'search': './plugin/search/search.es5',
|
||||||
|
'notes': './plugin/notes/notes.es5',
|
||||||
|
'zoom': './plugin/zoom/zoom.es5',
|
||||||
|
'math': './plugin/math/math.es5'
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
filename: '[name].js'
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
.on('error', swallowError)
|
||||||
|
.pipe(gulp.dest('./dist/plugin')))
|
||||||
|
|
||||||
gulp.task('css-themes', () => gulp.src(['./css/theme/source/*.{sass,scss}'])
|
gulp.task('css-themes', () => gulp.src(['./css/theme/source/*.{sass,scss}'])
|
||||||
.pipe(sass())
|
.pipe(sass())
|
||||||
.pipe(gulp.dest('./dist/theme')))
|
.pipe(gulp.dest('./dist/theme')))
|
||||||
|
|||||||
+3
-5
@@ -22,7 +22,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="dist/reveal.min.js"></script>
|
<script src="dist/reveal.min.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// More info about config & dependencies:
|
// More info about config & dependencies:
|
||||||
// - https://github.com/hakimel/reveal.js#configuration
|
// - https://github.com/hakimel/reveal.js#configuration
|
||||||
@@ -30,10 +29,9 @@
|
|||||||
Reveal.initialize({
|
Reveal.initialize({
|
||||||
hash: true,
|
hash: true,
|
||||||
dependencies: [
|
dependencies: [
|
||||||
{ src: 'plugin/markdown/marked.js' },
|
{ src: 'dist/plugin/markdown.js' },
|
||||||
{ src: 'plugin/markdown/markdown.js' },
|
{ src: 'dist/plugin/highlight.js' },
|
||||||
{ src: 'plugin/highlight/highlight.js' },
|
{ src: 'dist/plugin/notes.js' }
|
||||||
{ src: 'plugin/notes/notes.js', async: true }
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ export default class Plugins {
|
|||||||
|
|
||||||
// Load synchronous scripts
|
// Load synchronous scripts
|
||||||
scripts.forEach( s => {
|
scripts.forEach( s => {
|
||||||
if( s.plugin ) {
|
if( typeof s.id === 'string' ) {
|
||||||
this.registerPlugin( s.plugin );
|
this.registerPlugin( s );
|
||||||
scriptLoadedCallback( s );
|
scriptLoadedCallback( s );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import {
|
|||||||
deserialize,
|
deserialize,
|
||||||
transformElement,
|
transformElement,
|
||||||
createSingletonNode,
|
createSingletonNode,
|
||||||
closestParent,
|
|
||||||
getQueryHash,
|
getQueryHash,
|
||||||
getRemainingHeight
|
getRemainingHeight
|
||||||
} from './utils/util.js'
|
} from './utils/util.js'
|
||||||
|
|||||||
Generated
+5
@@ -5205,6 +5205,11 @@
|
|||||||
"minimalistic-assert": "^1.0.1"
|
"minimalistic-assert": "^1.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"highlight.js": {
|
||||||
|
"version": "9.18.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.18.1.tgz",
|
||||||
|
"integrity": "sha512-OrVKYz70LHsnCgmbXctv/bfuvntIKDz177h0Co37DQ5jamGZLVmoCVMtjMtNZY3X9DrCcKfklHPNeA0uPZhSJg=="
|
||||||
|
},
|
||||||
"hmac-drbg": {
|
"hmac-drbg": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
|
||||||
|
|||||||
@@ -87,5 +87,8 @@
|
|||||||
"no-eq-null": 2,
|
"no-eq-null": 2,
|
||||||
"no-unused-expressions": 0
|
"no-unused-expressions": 0
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"highlight.js": "^9.18.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/*! highlight.js v9.18.0 | BSD3 License | git.io/hljslicense */
|
||||||
|
!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"==typeof exports||exports.nodeType?n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs})):e(exports)}(function(a){var f=[],o=Object.keys,_={},g={},C=!0,n=/^(no-?highlight|plain|text)$/i,E=/\blang(?:uage)?-([\w-]+)\b/i,t=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,r={case_insensitive:"cI",lexemes:"l",contains:"c",keywords:"k",subLanguage:"sL",className:"cN",begin:"b",beginKeywords:"bK",end:"e",endsWithParent:"eW",illegal:"i",excludeBegin:"eB",excludeEnd:"eE",returnBegin:"rB",returnEnd:"rE",variants:"v",IDENT_RE:"IR",UNDERSCORE_IDENT_RE:"UIR",NUMBER_RE:"NR",C_NUMBER_RE:"CNR",BINARY_NUMBER_RE:"BNR",RE_STARTERS_RE:"RSR",BACKSLASH_ESCAPE:"BE",APOS_STRING_MODE:"ASM",QUOTE_STRING_MODE:"QSM",PHRASAL_WORDS_MODE:"PWM",C_LINE_COMMENT_MODE:"CLCM",C_BLOCK_COMMENT_MODE:"CBCM",HASH_COMMENT_MODE:"HCM",NUMBER_MODE:"NM",C_NUMBER_MODE:"CNM",BINARY_NUMBER_MODE:"BNM",CSS_NUMBER_MODE:"CSSNM",REGEXP_MODE:"RM",TITLE_MODE:"TM",UNDERSCORE_TITLE_MODE:"UTM",COMMENT:"C",beginRe:"bR",endRe:"eR",illegalRe:"iR",lexemesRe:"lR",terminators:"t",terminator_end:"tE"},m="</span>",O="Could not find the language '{}', did you forget to load/include a language module?",B={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},c="of and for in not or if then".split(" ");function x(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function d(e){return e.nodeName.toLowerCase()}function R(e){return n.test(e)}function i(e){var n,t={},r=Array.prototype.slice.call(arguments,1);for(n in e)t[n]=e[n];return r.forEach(function(e){for(n in e)t[n]=e[n]}),t}function p(e){var a=[];return function e(n,t){for(var r=n.firstChild;r;r=r.nextSibling)3===r.nodeType?t+=r.nodeValue.length:1===r.nodeType&&(a.push({event:"start",offset:t,node:r}),t=e(r,t),d(r).match(/br|hr|img|input/)||a.push({event:"stop",offset:t,node:r}));return t}(e,0),a}function v(e,n,t){var r=0,a="",i=[];function o(){return e.length&&n.length?e[0].offset!==n[0].offset?e[0].offset<n[0].offset?e:n:"start"===n[0].event?e:n:e.length?e:n}function c(e){a+="<"+d(e)+f.map.call(e.attributes,function(e){return" "+e.nodeName+'="'+x(e.value).replace(/"/g,""")+'"'}).join("")+">"}function l(e){a+="</"+d(e)+">"}function u(e){("start"===e.event?c:l)(e.node)}for(;e.length||n.length;){var s=o();if(a+=x(t.substring(r,s[0].offset)),r=s[0].offset,s===e){for(i.reverse().forEach(l);u(s.splice(0,1)[0]),(s=o())===e&&s.length&&s[0].offset===r;);i.reverse().forEach(c)}else"start"===s[0].event?i.push(s[0].node):i.pop(),u(s.splice(0,1)[0])}return a+x(t.substr(r))}function l(n){return n.v&&!n.cached_variants&&(n.cached_variants=n.v.map(function(e){return i(n,{v:null},e)})),n.cached_variants?n.cached_variants:function e(n){return!!n&&(n.eW||e(n.starts))}(n)?[i(n,{starts:n.starts?i(n.starts):null})]:Object.isFrozen(n)?[i(n)]:[n]}
|
||||||
|
function u(e){
|
||||||
|
if(r&&!e.langApiRestored){
|
||||||
|
if(Object.isFrozen(e)) return; // Added by Hakim to make highlight.js work in strict mode. Should be fixed once highlight.js 10 is out.
|
||||||
|
for(var n in e.langApiRestored=!0,r)e[n]&&(e[r[n]]=e[n]);(e.c||[]).concat(e.v||[]).forEach(u)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function M(n,t){var i={};return"string"==typeof n?r("keyword",n):o(n).forEach(function(e){r(e,n[e])}),i;function r(a,e){t&&(e=e.toLowerCase()),e.split(" ").forEach(function(e){var n,t,r=e.split("|");i[r[0]]=[a,(n=r[0],(t=r[1])?Number(t):function(e){return-1!=c.indexOf(e.toLowerCase())}(n)?0:1)]})}}function S(r){function s(e){return e&&e.source||e}function f(e,n){return new RegExp(s(e),"m"+(r.cI?"i":"")+(n?"g":""))}function a(a){var i,e,o={},c=[],l={},t=1;function n(e,n){o[t]=e,c.push([e,n]),t+=new RegExp(n.toString()+"|").exec("").length-1+1}for(var r=0;r<a.c.length;r++){n(e=a.c[r],e.bK?"\\.?(?:"+e.b+")\\.?":e.b)}a.tE&&n("end",a.tE),a.i&&n("illegal",a.i);var u=c.map(function(e){return e[1]});return i=f(function(e,n){for(var t=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./,r=0,a="",i=0;i<e.length;i++){var o=r+=1,c=s(e[i]);for(0<i&&(a+=n),a+="(";0<c.length;){var l=t.exec(c);if(null==l){a+=c;break}a+=c.substring(0,l.index),c=c.substring(l.index+l[0].length),"\\"==l[0][0]&&l[1]?a+="\\"+String(Number(l[1])+o):(a+=l[0],"("==l[0]&&r++)}a+=")"}return a}(u,"|"),!0),l.lastIndex=0,l.exec=function(e){var n;if(0===c.length)return null;i.lastIndex=l.lastIndex;var t=i.exec(e);if(!t)return null;for(var r=0;r<t.length;r++)if(null!=t[r]&&null!=o[""+r]){n=o[""+r];break}return"string"==typeof n?(t.type=n,t.extra=[a.i,a.tE]):(t.type="begin",t.rule=n),t},l}if(r.c&&-1!=r.c.indexOf("self")){if(!C)throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");r.c=r.c.filter(function(e){return"self"!=e})}!function n(t,e){t.compiled||(t.compiled=!0,t.k=t.k||t.bK,t.k&&(t.k=M(t.k,r.cI)),t.lR=f(t.l||/\w+/,!0),e&&(t.bK&&(t.b="\\b("+t.bK.split(" ").join("|")+")\\b"),t.b||(t.b=/\B|\b/),t.bR=f(t.b),t.endSameAsBegin&&(t.e=t.b),t.e||t.eW||(t.e=/\B|\b/),t.e&&(t.eR=f(t.e)),t.tE=s(t.e)||"",t.eW&&e.tE&&(t.tE+=(t.e?"|":"")+e.tE)),t.i&&(t.iR=f(t.i)),null==t.relevance&&(t.relevance=1),t.c||(t.c=[]),t.c=Array.prototype.concat.apply([],t.c.map(function(e){return l("self"===e?t:e)})),t.c.forEach(function(e){n(e,t)}),t.starts&&n(t.starts,e),t.t=a(t))}(r)}function T(n,e,a,t){var i=e;function c(e,n,t,r){if(!t&&""===n)return"";if(!e)return n;var a='<span class="'+(r?"":B.classPrefix);return(a+=e+'">')+n+(t?"":m)}function o(){p+=(null!=d.sL?function(){var e="string"==typeof d.sL;if(e&&!_[d.sL])return x(v);var n=e?T(d.sL,v,!0,R[d.sL]):w(v,d.sL.length?d.sL:void 0);return 0<d.relevance&&(M+=n.relevance),e&&(R[d.sL]=n.top),c(n.language,n.value,!1,!0)}:function(){var e,n,t,r,a,i,o;if(!d.k)return x(v);for(r="",n=0,d.lR.lastIndex=0,t=d.lR.exec(v);t;)r+=x(v.substring(n,t.index)),a=d,i=t,o=g.cI?i[0].toLowerCase():i[0],(e=a.k.hasOwnProperty(o)&&a.k[o])?(M+=e[1],r+=c(e[0],x(t[0]))):r+=x(t[0]),n=d.lR.lastIndex,t=d.lR.exec(v);return r+x(v.substr(n))})(),v=""}function l(e){p+=e.cN?c(e.cN,"",!0):"",d=Object.create(e,{parent:{value:d}})}function u(e){var n=e[0],t=e.rule;return t&&t.endSameAsBegin&&(t.eR=new RegExp(n.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"m")),t.skip?v+=n:(t.eB&&(v+=n),o(),t.rB||t.eB||(v=n)),l(t),t.rB?0:n.length}function s(e){var n=e[0],t=i.substr(e.index),r=function e(n,t){if(r=n.eR,a=t,(i=r&&r.exec(a))&&0===i.index){for(;n.endsParent&&n.parent;)n=n.parent;return n}var r,a,i;if(n.eW)return e(n.parent,t)}(d,t);if(r){var a=d;for(a.skip?v+=n:(a.rE||a.eE||(v+=n),o(),a.eE&&(v=n));d.cN&&(p+=m),d.skip||d.sL||(M+=d.relevance),(d=d.parent)!==r.parent;);return r.starts&&(r.endSameAsBegin&&(r.starts.eR=r.eR),l(r.starts)),a.rE?0:n.length}}var f={};function r(e,n){var t=n&&n[0];if(v+=e,null==t)return o(),0;if("begin"==f.type&&"end"==n.type&&f.index==n.index&&""===t)return v+=i.slice(n.index,n.index+1),1;if("begin"===(f=n).type)return u(n);if("illegal"===n.type&&!a)throw new Error('Illegal lexeme "'+t+'" for mode "'+(d.cN||"<unnamed>")+'"');if("end"===n.type){var r=s(n);if(null!=r)return r}return v+=t,t.length}var g=D(n);if(!g)throw console.error(O.replace("{}",n)),new Error('Unknown language: "'+n+'"');S(g);var E,d=t||g,R={},p="";for(E=d;E!==g;E=E.parent)E.cN&&(p=c(E.cN,"",!0)+p);var v="",M=0;try{for(var b,h,N=0;d.t.lastIndex=N,b=d.t.exec(i);)h=r(i.substring(N,b.index),b),N=b.index+h;for(r(i.substr(N)),E=d;E.parent;E=E.parent)E.cN&&(p+=m);return{relevance:M,value:p,i:!1,language:n,top:d}}catch(e){if(e.message&&-1!==e.message.indexOf("Illegal"))return{i:!0,relevance:0,value:x(i)};if(C)return{relevance:0,value:x(i),language:n,top:d,errorRaised:e};throw e}}function w(t,e){e=e||B.languages||o(_);var r={relevance:0,value:x(t)},a=r;return e.filter(D).filter(L).forEach(function(e){var n=T(e,t,!1);n.language=e,n.relevance>a.relevance&&(a=n),n.relevance>r.relevance&&(a=r,r=n)}),a.language&&(r.second_best=a),r}function b(e){return B.tabReplace||B.useBR?e.replace(t,function(e,n){return B.useBR&&"\n"===e?"<br>":B.tabReplace?n.replace(/\t/g,B.tabReplace):""}):e}function s(e){var n,t,r,a,i,o,c,l,u,s,f=function(e){var n,t,r,a,i=e.className+" ";if(i+=e.parentNode?e.parentNode.className:"",t=E.exec(i)){var o=D(t[1]);return o||(consoleLine truncated
|
||||||
|
|
||||||
|
export default hljs;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/* highlightjs-line-numbers.js 2.6.0 | (C) 2018 Yauheni Pakala | MIT License | github.com/wcoder/highlightjs-line-numbers.js */
|
||||||
|
/* Edited by Hakim for reveal.js; removed async timeout */
|
||||||
|
!function(n,e){"use strict";function t(){var n=e.createElement("style");n.type="text/css",n.innerHTML=g(".{0}{border-collapse:collapse}.{0} td{padding:0}.{1}:before{content:attr({2})}",[v,L,b]),e.getElementsByTagName("head")[0].appendChild(n)}function r(t){"interactive"===e.readyState||"complete"===e.readyState?i(t):n.addEventListener("DOMContentLoaded",function(){i(t)})}function i(t){try{var r=e.querySelectorAll("code.hljs,code.nohighlight");for(var i in r)r.hasOwnProperty(i)&&l(r[i],t)}catch(o){n.console.error("LineNumbers error: ",o)}}function l(n,e){"object"==typeof n&&f(function(){n.innerHTML=s(n,e)})}function o(n,e){if("string"==typeof n){var t=document.createElement("code");return t.innerHTML=n,s(t,e)}}function s(n,e){e=e||{singleLine:!1};var t=e.singleLine?0:1;return c(n),a(n.innerHTML,t)}function a(n,e){var t=u(n);if(""===t[t.length-1].trim()&&t.pop(),t.length>e){for(var r="",i=0,l=t.length;i<l;i++)r+=g('<tr><td class="{0}"><div class="{1} {2}" {3}="{5}"></div></td><td class="{4}"><div class="{1}">{6}</div></td></tr>',[j,m,L,b,p,i+1,t[i].length>0?t[i]:" "]);return g('<table class="{0}">{1}</table>',[v,r])}return n}function c(n){var e=n.childNodes;for(var t in e)if(e.hasOwnProperty(t)){var r=e[t];h(r.textContent)>0&&(r.childNodes.length>0?c(r):d(r.parentNode))}}function d(n){var e=n.className;if(/hljs-/.test(e)){for(var t=u(n.innerHTML),r=0,i="";r<t.length;r++){var l=t[r].length>0?t[r]:" ";i+=g('<span class="{0}">{1}</span>\n',[e,l])}n.innerHTML=i.trim()}}function u(n){return 0===n.length?[]:n.split(y)}function h(n){return(n.trim().match(y)||[]).length}function f(e){e()}function g(n,e){return n.replace(/\{(\d+)\}/g,function(n,t){return e[t]?e[t]:n})}var v="hljs-ln",m="hljs-ln-line",p="hljs-ln-code",j="hljs-ln-numbers",L="hljs-ln-n",b="data-line-number",y=/\r\n|\r|\n/g;n.hljs?(n.hljs.initLineNumbersOnLoad=r,n.hljs.lineNumbersBlock=l,n.hljs.lineNumbersValue=o,t()):n.console.error("highlight.js not detected!")}(window,document);
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* This is used to compile a self-registering
|
||||||
|
* es5 compatible version of the plugin.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import plugin from './highlight.js'
|
||||||
|
Reveal.registerPlugin( plugin );
|
||||||
+360
-379
@@ -1,425 +1,406 @@
|
|||||||
/*! highlight.js v9.18.0 | BSD3 License | git.io/hljslicense */
|
import hljs from './highlight-core.js'
|
||||||
!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"==typeof exports||exports.nodeType?n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs})):e(exports)}(function(a){var f=[],o=Object.keys,_={},g={},C=!0,n=/^(no-?highlight|plain|text)$/i,E=/\blang(?:uage)?-([\w-]+)\b/i,t=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,r={case_insensitive:"cI",lexemes:"l",contains:"c",keywords:"k",subLanguage:"sL",className:"cN",begin:"b",beginKeywords:"bK",end:"e",endsWithParent:"eW",illegal:"i",excludeBegin:"eB",excludeEnd:"eE",returnBegin:"rB",returnEnd:"rE",variants:"v",IDENT_RE:"IR",UNDERSCORE_IDENT_RE:"UIR",NUMBER_RE:"NR",C_NUMBER_RE:"CNR",BINARY_NUMBER_RE:"BNR",RE_STARTERS_RE:"RSR",BACKSLASH_ESCAPE:"BE",APOS_STRING_MODE:"ASM",QUOTE_STRING_MODE:"QSM",PHRASAL_WORDS_MODE:"PWM",C_LINE_COMMENT_MODE:"CLCM",C_BLOCK_COMMENT_MODE:"CBCM",HASH_COMMENT_MODE:"HCM",NUMBER_MODE:"NM",C_NUMBER_MODE:"CNM",BINARY_NUMBER_MODE:"BNM",CSS_NUMBER_MODE:"CSSNM",REGEXP_MODE:"RM",TITLE_MODE:"TM",UNDERSCORE_TITLE_MODE:"UTM",COMMENT:"C",beginRe:"bR",endRe:"eR",illegalRe:"iR",lexemesRe:"lR",terminators:"t",terminator_end:"tE"},m="</span>",O="Could not find the language '{}', did you forget to load/include a language module?",B={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},c="of and for in not or if then".split(" ");function x(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function d(e){return e.nodeName.toLowerCase()}function R(e){return n.test(e)}function i(e){var n,t={},r=Array.prototype.slice.call(arguments,1);for(n in e)t[n]=e[n];return r.forEach(function(e){for(n in e)t[n]=e[n]}),t}function p(e){var a=[];return function e(n,t){for(var r=n.firstChild;r;r=r.nextSibling)3===r.nodeType?t+=r.nodeValue.length:1===r.nodeType&&(a.push({event:"start",offset:t,node:r}),t=e(r,t),d(r).match(/br|hr|img|input/)||a.push({event:"stop",offset:t,node:r}));return t}(e,0),a}function v(e,n,t){var r=0,a="",i=[];function o(){return e.length&&n.length?e[0].offset!==n[0].offset?e[0].offset<n[0].offset?e:n:"start"===n[0].event?e:n:e.length?e:n}function c(e){a+="<"+d(e)+f.map.call(e.attributes,function(e){return" "+e.nodeName+'="'+x(e.value).replace(/"/g,""")+'"'}).join("")+">"}function l(e){a+="</"+d(e)+">"}function u(e){("start"===e.event?c:l)(e.node)}for(;e.length||n.length;){var s=o();if(a+=x(t.substring(r,s[0].offset)),r=s[0].offset,s===e){for(i.reverse().forEach(l);u(s.splice(0,1)[0]),(s=o())===e&&s.length&&s[0].offset===r;);i.reverse().forEach(c)}else"start"===s[0].event?i.push(s[0].node):i.pop(),u(s.splice(0,1)[0])}return a+x(t.substr(r))}function l(n){return n.v&&!n.cached_variants&&(n.cached_variants=n.v.map(function(e){return i(n,{v:null},e)})),n.cached_variants?n.cached_variants:function e(n){return!!n&&(n.eW||e(n.starts))}(n)?[i(n,{starts:n.starts?i(n.starts):null})]:Object.isFrozen(n)?[i(n)]:[n]}function u(e){if(r&&!e.langApiRestored){for(var n in e.langApiRestored=!0,r)e[n]&&(e[r[n]]=e[n]);(e.c||[]).concat(e.v||[]).forEach(u)}}function M(n,t){var i={};return"string"==typeof n?r("keyword",n):o(n).forEach(function(e){r(e,n[e])}),i;function r(a,e){t&&(e=e.toLowerCase()),e.split(" ").forEach(function(e){var n,t,r=e.split("|");i[r[0]]=[a,(n=r[0],(t=r[1])?Number(t):function(e){return-1!=c.indexOf(e.toLowerCase())}(n)?0:1)]})}}function S(r){function s(e){return e&&e.source||e}function f(e,n){return new RegExp(s(e),"m"+(r.cI?"i":"")+(n?"g":""))}function a(a){var i,e,o={},c=[],l={},t=1;function n(e,n){o[t]=e,c.push([e,n]),t+=new RegExp(n.toString()+"|").exec("").length-1+1}for(var r=0;r<a.c.length;r++){n(e=a.c[r],e.bK?"\\.?(?:"+e.b+")\\.?":e.b)}a.tE&&n("end",a.tE),a.i&&n("illegal",a.i);var u=c.map(function(e){return e[1]});return i=f(function(e,n){for(var t=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./,r=0,a="",i=0;i<e.length;i++){var o=r+=1,c=s(e[i]);for(0<i&&(a+=n),a+="(";0<c.length;){var l=t.exec(c);if(null==l){a+=c;break}a+=c.substring(0,l.index),c=c.substring(l.index+l[0].length),"\\"==l[0][0]&&l[1]?a+="\\"+String(Number(l[1])+o):(a+=l[0],"("==l[0]&&r++)}a+=")"}return a}(u,"|"),!0),l.lastIndex=0,l.exec=function(e){var n;if(0===c.length)return null;i.lastIndex=l.lastIndex;var t=i.exec(e);if(!t)return null;for(var r=0;r<t.length;r++)if(null!=t[r]&&null!=o[""+r]){n=o[""+r];break}return"string"==typeof n?(t.type=n,t.extra=[a.i,a.tE]):(t.type="begin",t.rule=n),t},l}if(r.c&&-1!=r.c.indexOf("self")){if(!C)throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");r.c=r.c.filter(function(e){return"self"!=e})}!function n(t,e){t.compiled||(t.compiled=!0,t.k=t.k||t.bK,t.k&&(t.k=M(t.k,r.cI)),t.lR=f(t.l||/\w+/,!0),e&&(t.bK&&(t.b="\\b("+t.bK.split(" ").join("|")+")\\b"),t.b||(t.b=/\B|\b/),t.bR=f(t.b),t.endSameAsBegin&&(t.e=t.b),t.e||t.eW||(t.e=/\B|\b/),t.e&&(t.eR=f(t.e)),t.tE=s(t.e)||"",t.eW&&e.tE&&(t.tE+=(t.e?"|":"")+e.tE)),t.i&&(t.iR=f(t.i)),null==t.relevance&&(t.relevance=1),t.c||(t.c=[]),t.c=Array.prototyLine truncated
|
import './highlight-line-numbers.js'
|
||||||
|
|
||||||
/* highlightjs-line-numbers.js 2.6.0 | (C) 2018 Yauheni Pakala | MIT License | github.com/wcoder/highlightjs-line-numbers.js */
|
/*!
|
||||||
/* Edited by Hakim for reveal.js; removed async timeout */
|
* reveal.js plugin that adds syntax highlight support.
|
||||||
!function(n,e){"use strict";function t(){var n=e.createElement("style");n.type="text/css",n.innerHTML=g(".{0}{border-collapse:collapse}.{0} td{padding:0}.{1}:before{content:attr({2})}",[v,L,b]),e.getElementsByTagName("head")[0].appendChild(n)}function r(t){"interactive"===e.readyState||"complete"===e.readyState?i(t):n.addEventListener("DOMContentLoaded",function(){i(t)})}function i(t){try{var r=e.querySelectorAll("code.hljs,code.nohighlight");for(var i in r)r.hasOwnProperty(i)&&l(r[i],t)}catch(o){n.console.error("LineNumbers error: ",o)}}function l(n,e){"object"==typeof n&&f(function(){n.innerHTML=s(n,e)})}function o(n,e){if("string"==typeof n){var t=document.createElement("code");return t.innerHTML=n,s(t,e)}}function s(n,e){e=e||{singleLine:!1};var t=e.singleLine?0:1;return c(n),a(n.innerHTML,t)}function a(n,e){var t=u(n);if(""===t[t.length-1].trim()&&t.pop(),t.length>e){for(var r="",i=0,l=t.length;i<l;i++)r+=g('<tr><td class="{0}"><div class="{1} {2}" {3}="{5}"></div></td><td class="{4}"><div class="{1}">{6}</div></td></tr>',[j,m,L,b,p,i+1,t[i].length>0?t[i]:" "]);return g('<table class="{0}">{1}</table>',[v,r])}return n}function c(n){var e=n.childNodes;for(var t in e)if(e.hasOwnProperty(t)){var r=e[t];h(r.textContent)>0&&(r.childNodes.length>0?c(r):d(r.parentNode))}}function d(n){var e=n.className;if(/hljs-/.test(e)){for(var t=u(n.innerHTML),r=0,i="";r<t.length;r++){var l=t[r].length>0?t[r]:" ";i+=g('<span class="{0}">{1}</span>\n',[e,l])}n.innerHTML=i.trim()}}function u(n){return 0===n.length?[]:n.split(y)}function h(n){return(n.trim().match(y)||[]).length}function f(e){e()}function g(n,e){return n.replace(/\{(\d+)\}/g,function(n,t){return e[t]?e[t]:n})}var v="hljs-ln",m="hljs-ln-line",p="hljs-ln-code",j="hljs-ln-numbers",L="hljs-ln-n",b="data-line-number",y=/\r\n|\r|\n/g;n.hljs?(n.hljs.initLineNumbersOnLoad=r,n.hljs.lineNumbersBlock=l,n.hljs.lineNumbersValue=o,t()):n.console.error("highlight.js not detected!")}(window,document);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This reveal.js plugin is wrapper around the highlight.js
|
|
||||||
* syntax highlighting library.
|
|
||||||
*/
|
*/
|
||||||
(function( root, factory ) {
|
|
||||||
if (typeof define === 'function' && define.amd) {
|
|
||||||
root.RevealHighlight = factory();
|
|
||||||
} else if( typeof exports === 'object' ) {
|
|
||||||
module.exports = factory();
|
|
||||||
} else {
|
|
||||||
// Browser globals (root is window)
|
|
||||||
root.RevealHighlight = factory();
|
|
||||||
}
|
|
||||||
}( this, function() {
|
|
||||||
|
|
||||||
// Function to perform a better "data-trim" on code snippets
|
// Function to perform a better "data-trim" on code snippets
|
||||||
// Will slice an indentation amount on each line of the snippet (amount based on the line having the lowest indentation length)
|
// Will slice an indentation amount on each line of the snippet (amount based on the line having the lowest indentation length)
|
||||||
function betterTrim(snippetEl) {
|
function betterTrim(snippetEl) {
|
||||||
// Helper functions
|
// Helper functions
|
||||||
function trimLeft(val) {
|
function trimLeft(val) {
|
||||||
// Adapted from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
|
// Adapted from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
|
||||||
return val.replace(/^[\s\uFEFF\xA0]+/g, '');
|
return val.replace(/^[\s\uFEFF\xA0]+/g, '');
|
||||||
}
|
}
|
||||||
function trimLineBreaks(input) {
|
function trimLineBreaks(input) {
|
||||||
var lines = input.split('\n');
|
var lines = input.split('\n');
|
||||||
|
|
||||||
// Trim line-breaks from the beginning
|
// Trim line-breaks from the beginning
|
||||||
for (var i = 0; i < lines.length; i++) {
|
for (var i = 0; i < lines.length; i++) {
|
||||||
if (lines[i].trim() === '') {
|
if (lines[i].trim() === '') {
|
||||||
lines.splice(i--, 1);
|
lines.splice(i--, 1);
|
||||||
} else break;
|
} else break;
|
||||||
}
|
|
||||||
|
|
||||||
// Trim line-breaks from the end
|
|
||||||
for (var i = lines.length-1; i >= 0; i--) {
|
|
||||||
if (lines[i].trim() === '') {
|
|
||||||
lines.splice(i, 1);
|
|
||||||
} else break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return lines.join('\n');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main function for betterTrim()
|
// Trim line-breaks from the end
|
||||||
return (function(snippetEl) {
|
for (var i = lines.length-1; i >= 0; i--) {
|
||||||
var content = trimLineBreaks(snippetEl.innerHTML);
|
if (lines[i].trim() === '') {
|
||||||
var lines = content.split('\n');
|
lines.splice(i, 1);
|
||||||
// Calculate the minimum amount to remove on each line start of the snippet (can be 0)
|
} else break;
|
||||||
var pad = lines.reduce(function(acc, line) {
|
}
|
||||||
if (line.length > 0 && trimLeft(line).length > 0 && acc > line.length - trimLeft(line).length) {
|
|
||||||
return line.length - trimLeft(line).length;
|
return lines.join('\n');
|
||||||
}
|
|
||||||
return acc;
|
|
||||||
}, Number.POSITIVE_INFINITY);
|
|
||||||
// Slice each line with this amount
|
|
||||||
return lines.map(function(line, index) {
|
|
||||||
return line.slice(pad);
|
|
||||||
})
|
|
||||||
.join('\n');
|
|
||||||
})(snippetEl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var RevealHighlight = {
|
// Main function for betterTrim()
|
||||||
|
return (function(snippetEl) {
|
||||||
|
var content = trimLineBreaks(snippetEl.innerHTML);
|
||||||
|
var lines = content.split('\n');
|
||||||
|
// Calculate the minimum amount to remove on each line start of the snippet (can be 0)
|
||||||
|
var pad = lines.reduce(function(acc, line) {
|
||||||
|
if (line.length > 0 && trimLeft(line).length > 0 && acc > line.length - trimLeft(line).length) {
|
||||||
|
return line.length - trimLeft(line).length;
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}, Number.POSITIVE_INFINITY);
|
||||||
|
// Slice each line with this amount
|
||||||
|
return lines.map(function(line, index) {
|
||||||
|
return line.slice(pad);
|
||||||
|
})
|
||||||
|
.join('\n');
|
||||||
|
})(snippetEl);
|
||||||
|
}
|
||||||
|
|
||||||
id: 'highlight',
|
var RevealHighlight = {
|
||||||
|
|
||||||
HIGHLIGHT_STEP_DELIMITER: '|',
|
id: 'highlight',
|
||||||
HIGHLIGHT_LINE_DELIMITER: ',',
|
|
||||||
HIGHLIGHT_LINE_RANGE_DELIMITER: '-',
|
|
||||||
|
|
||||||
init: function( deck ) {
|
HIGHLIGHT_STEP_DELIMITER: '|',
|
||||||
|
HIGHLIGHT_LINE_DELIMITER: ',',
|
||||||
|
HIGHLIGHT_LINE_RANGE_DELIMITER: '-',
|
||||||
|
|
||||||
// Read the plugin config options and provide fallbacks
|
init: function( deck ) {
|
||||||
var config = deck.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 ) {
|
// Read the plugin config options and provide fallbacks
|
||||||
|
var config = deck.getConfig().highlight || {};
|
||||||
|
config.highlightOnLoad = typeof config.highlightOnLoad === 'boolean' ? config.highlightOnLoad : true;
|
||||||
|
config.escapeHTML = typeof config.escapeHTML === 'boolean' ? config.escapeHTML : true;
|
||||||
|
|
||||||
// Trim whitespace if the "data-trim" attribute is present
|
[].slice.call( document.querySelectorAll( '.reveal pre code' ) ).forEach( function( block ) {
|
||||||
if( block.hasAttribute( 'data-trim' ) && typeof block.innerHTML.trim === 'function' ) {
|
|
||||||
block.innerHTML = betterTrim( block );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Escape HTML tags unless the "data-noescape" attrbute is present
|
// Trim whitespace if the "data-trim" attribute is present
|
||||||
if( config.escapeHTML && !block.hasAttribute( 'data-noescape' )) {
|
if( block.hasAttribute( 'data-trim' ) && typeof block.innerHTML.trim === 'function' ) {
|
||||||
block.innerHTML = block.innerHTML.replace( /</g,"<").replace(/>/g, '>' );
|
block.innerHTML = betterTrim( block );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-highlight when focus is lost (for contenteditable code)
|
// Escape HTML tags unless the "data-noescape" attrbute is present
|
||||||
block.addEventListener( 'focusout', function( event ) {
|
if( config.escapeHTML && !block.hasAttribute( 'data-noescape' )) {
|
||||||
hljs.highlightBlock( event.currentTarget );
|
block.innerHTML = block.innerHTML.replace( /</g,"<").replace(/>/g, '>' );
|
||||||
}, false );
|
}
|
||||||
|
|
||||||
if( config.highlightOnLoad ) {
|
// Re-highlight when focus is lost (for contenteditable code)
|
||||||
RevealHighlight.highlightBlock( block );
|
block.addEventListener( 'focusout', function( event ) {
|
||||||
}
|
hljs.highlightBlock( event.currentTarget );
|
||||||
|
}, false );
|
||||||
|
|
||||||
|
if( config.highlightOnLoad ) {
|
||||||
|
RevealHighlight.highlightBlock( block );
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
// 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 ) {
|
||||||
|
RevealHighlight.scrollHighlightedLineIntoView( block, {}, true );
|
||||||
} );
|
} );
|
||||||
|
} );
|
||||||
|
|
||||||
// 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 ) {
|
|
||||||
RevealHighlight.scrollHighlightedLineIntoView( block, {}, true );
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
|
|
||||||
},
|
/**
|
||||||
|
* Highlights a code block. If the <code> node has the
|
||||||
|
* 'data-line-numbers' attribute we also generate slide
|
||||||
|
* numbers.
|
||||||
|
*
|
||||||
|
* If the block contains multiple line highlight steps,
|
||||||
|
* we clone the block and create a fragment for each step.
|
||||||
|
*/
|
||||||
|
highlightBlock: function( block ) {
|
||||||
|
|
||||||
/**
|
hljs.highlightBlock( block );
|
||||||
* Highlights a code block. If the <code> node has the
|
|
||||||
* 'data-line-numbers' attribute we also generate slide
|
|
||||||
* numbers.
|
|
||||||
*
|
|
||||||
* If the block contains multiple line highlight steps,
|
|
||||||
* we clone the block and create a fragment for each step.
|
|
||||||
*/
|
|
||||||
highlightBlock: function( block ) {
|
|
||||||
|
|
||||||
hljs.highlightBlock( block );
|
// Don't generate line numbers for empty code blocks
|
||||||
|
if( block.innerHTML.trim().length === 0 ) return;
|
||||||
|
|
||||||
// Don't generate line numbers for empty code blocks
|
if( block.hasAttribute( 'data-line-numbers' ) ) {
|
||||||
if( block.innerHTML.trim().length === 0 ) return;
|
hljs.lineNumbersBlock( block, { singleLine: true } );
|
||||||
|
|
||||||
if( block.hasAttribute( 'data-line-numbers' ) ) {
|
var scrollState = { currentBlock: block };
|
||||||
hljs.lineNumbersBlock( block, { singleLine: true } );
|
|
||||||
|
|
||||||
var scrollState = { currentBlock: block };
|
// If there is at least one highlight step, generate
|
||||||
|
// fragments
|
||||||
|
var highlightSteps = RevealHighlight.deserializeHighlightSteps( block.getAttribute( 'data-line-numbers' ) );
|
||||||
|
if( highlightSteps.length > 1 ) {
|
||||||
|
|
||||||
// If there is at least one highlight step, generate
|
// If the original code block has a fragment-index,
|
||||||
// fragments
|
// each clone should follow in an incremental sequence
|
||||||
var highlightSteps = RevealHighlight.deserializeHighlightSteps( block.getAttribute( 'data-line-numbers' ) );
|
var fragmentIndex = parseInt( block.getAttribute( 'data-fragment-index' ), 10 );
|
||||||
if( highlightSteps.length > 1 ) {
|
|
||||||
|
|
||||||
// If the original code block has a fragment-index,
|
if( typeof fragmentIndex !== 'number' || isNaN( fragmentIndex ) ) {
|
||||||
// each clone should follow in an incremental sequence
|
fragmentIndex = null;
|
||||||
var fragmentIndex = parseInt( block.getAttribute( 'data-fragment-index' ), 10 );
|
}
|
||||||
|
|
||||||
if( typeof fragmentIndex !== 'number' || isNaN( fragmentIndex ) ) {
|
// Generate fragments for all steps except the original block
|
||||||
fragmentIndex = null;
|
highlightSteps.slice(1).forEach( function( highlight ) {
|
||||||
|
|
||||||
|
var fragmentBlock = block.cloneNode( true );
|
||||||
|
fragmentBlock.setAttribute( 'data-line-numbers', RevealHighlight.serializeHighlightSteps( [ highlight ] ) );
|
||||||
|
fragmentBlock.classList.add( 'fragment' );
|
||||||
|
block.parentNode.appendChild( fragmentBlock );
|
||||||
|
RevealHighlight.highlightLines( fragmentBlock );
|
||||||
|
|
||||||
|
if( typeof fragmentIndex === 'number' ) {
|
||||||
|
fragmentBlock.setAttribute( 'data-fragment-index', fragmentIndex );
|
||||||
|
fragmentIndex += 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fragmentBlock.removeAttribute( 'data-fragment-index' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate fragments for all steps except the original block
|
// Scroll highlights into view as we step through them
|
||||||
highlightSteps.slice(1).forEach( function( highlight ) {
|
fragmentBlock.addEventListener( 'visible', RevealHighlight.scrollHighlightedLineIntoView.bind( RevealHighlight, fragmentBlock, scrollState ) );
|
||||||
|
fragmentBlock.addEventListener( 'hidden', RevealHighlight.scrollHighlightedLineIntoView.bind( RevealHighlight, fragmentBlock.previousSibling, scrollState ) );
|
||||||
|
|
||||||
var fragmentBlock = block.cloneNode( true );
|
} );
|
||||||
fragmentBlock.setAttribute( 'data-line-numbers', RevealHighlight.serializeHighlightSteps( [ highlight ] ) );
|
|
||||||
fragmentBlock.classList.add( 'fragment' );
|
|
||||||
block.parentNode.appendChild( fragmentBlock );
|
|
||||||
RevealHighlight.highlightLines( fragmentBlock );
|
|
||||||
|
|
||||||
if( typeof fragmentIndex === 'number' ) {
|
block.removeAttribute( 'data-fragment-index' )
|
||||||
fragmentBlock.setAttribute( 'data-fragment-index', fragmentIndex );
|
block.setAttribute( 'data-line-numbers', RevealHighlight.serializeHighlightSteps( [ highlightSteps[0] ] ) );
|
||||||
fragmentIndex += 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fragmentBlock.removeAttribute( 'data-fragment-index' );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scroll highlights into view as we step through them
|
}
|
||||||
fragmentBlock.addEventListener( 'visible', RevealHighlight.scrollHighlightedLineIntoView.bind( RevealHighlight, fragmentBlock, scrollState ) );
|
|
||||||
fragmentBlock.addEventListener( 'hidden', RevealHighlight.scrollHighlightedLineIntoView.bind( RevealHighlight, fragmentBlock.previousSibling, scrollState ) );
|
|
||||||
|
|
||||||
|
// Scroll the first highlight into view when the slide
|
||||||
|
// becomes visible. Note supported in IE11 since it lacks
|
||||||
|
// support for Element.closest.
|
||||||
|
var slide = typeof block.closest === 'function' ? block.closest( 'section:not(.stack)' ) : null;
|
||||||
|
if( slide ) {
|
||||||
|
var scrollFirstHighlightIntoView = function() {
|
||||||
|
RevealHighlight.scrollHighlightedLineIntoView( block, scrollState, true );
|
||||||
|
slide.removeEventListener( 'visible', scrollFirstHighlightIntoView );
|
||||||
|
}
|
||||||
|
slide.addEventListener( 'visible', scrollFirstHighlightIntoView );
|
||||||
|
}
|
||||||
|
|
||||||
|
RevealHighlight.highlightLines( block );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Animates scrolling to the first highlighted line
|
||||||
|
* in the given code block.
|
||||||
|
*/
|
||||||
|
scrollHighlightedLineIntoView: function( block, scrollState, skipAnimation ) {
|
||||||
|
|
||||||
|
cancelAnimationFrame( scrollState.animationFrameID );
|
||||||
|
|
||||||
|
// Match the scroll position of the currently visible
|
||||||
|
// code block
|
||||||
|
if( scrollState.currentBlock ) {
|
||||||
|
block.scrollTop = scrollState.currentBlock.scrollTop;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remember the current code block so that we can match
|
||||||
|
// its scroll position when showing/hiding fragments
|
||||||
|
scrollState.currentBlock = block;
|
||||||
|
|
||||||
|
var highlightBounds = this.getHighlightedLineBounds( block )
|
||||||
|
var viewportHeight = block.offsetHeight;
|
||||||
|
|
||||||
|
// Subtract padding from the viewport height
|
||||||
|
var blockStyles = getComputedStyle( block );
|
||||||
|
viewportHeight -= parseInt( blockStyles.paddingTop ) + parseInt( blockStyles.paddingBottom );
|
||||||
|
|
||||||
|
// Scroll position which centers all highlights
|
||||||
|
var startTop = block.scrollTop;
|
||||||
|
var targetTop = highlightBounds.top + ( Math.min( highlightBounds.bottom - highlightBounds.top, viewportHeight ) - viewportHeight ) / 2;
|
||||||
|
|
||||||
|
// Account for offsets in position applied to the
|
||||||
|
// <table> that holds our lines of code
|
||||||
|
var lineTable = block.querySelector( '.hljs-ln' );
|
||||||
|
if( lineTable ) targetTop += lineTable.offsetTop - parseInt( blockStyles.paddingTop );
|
||||||
|
|
||||||
|
// Make sure the scroll target is within bounds
|
||||||
|
targetTop = Math.max( Math.min( targetTop, block.scrollHeight - viewportHeight ), 0 );
|
||||||
|
|
||||||
|
if( skipAnimation === true || startTop === targetTop ) {
|
||||||
|
block.scrollTop = targetTop;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
// Don't attempt to scroll if there is no overflow
|
||||||
|
if( block.scrollHeight <= viewportHeight ) return;
|
||||||
|
|
||||||
|
var time = 0;
|
||||||
|
var animate = function() {
|
||||||
|
time = Math.min( time + 0.02, 1 );
|
||||||
|
|
||||||
|
// Update our eased scroll position
|
||||||
|
block.scrollTop = startTop + ( targetTop - startTop ) * RevealHighlight.easeInOutQuart( time );
|
||||||
|
|
||||||
|
// Keep animating unless we've reached the end
|
||||||
|
if( time < 1 ) {
|
||||||
|
scrollState.animationFrameID = requestAnimationFrame( animate );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
animate();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The easing function used when scrolling.
|
||||||
|
*/
|
||||||
|
easeInOutQuart: function( t ) {
|
||||||
|
|
||||||
|
// easeInOutQuart
|
||||||
|
return t<.5 ? 8*t*t*t*t : 1-8*(--t)*t*t*t;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
getHighlightedLineBounds: function( block ) {
|
||||||
|
|
||||||
|
var highlightedLines = block.querySelectorAll( '.highlight-line' );
|
||||||
|
if( highlightedLines.length === 0 ) {
|
||||||
|
return { top: 0, bottom: 0 };
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var firstHighlight = highlightedLines[0];
|
||||||
|
var lastHighlight = highlightedLines[ highlightedLines.length -1 ];
|
||||||
|
|
||||||
|
return {
|
||||||
|
top: firstHighlight.offsetTop,
|
||||||
|
bottom: lastHighlight.offsetTop + lastHighlight.offsetHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visually emphasize specific lines within a code block.
|
||||||
|
* This only works on blocks with line numbering turned on.
|
||||||
|
*
|
||||||
|
* @param {HTMLElement} block a <code> block
|
||||||
|
* @param {String} [linesToHighlight] The lines that should be
|
||||||
|
* highlighted in this format:
|
||||||
|
* "1" = highlights line 1
|
||||||
|
* "2,5" = highlights lines 2 & 5
|
||||||
|
* "2,5-7" = highlights lines 2, 5, 6 & 7
|
||||||
|
*/
|
||||||
|
highlightLines: function( block, linesToHighlight ) {
|
||||||
|
|
||||||
|
var highlightSteps = RevealHighlight.deserializeHighlightSteps( linesToHighlight || block.getAttribute( 'data-line-numbers' ) );
|
||||||
|
|
||||||
|
if( highlightSteps.length ) {
|
||||||
|
|
||||||
|
highlightSteps[0].forEach( function( highlight ) {
|
||||||
|
|
||||||
|
var elementsToHighlight = [];
|
||||||
|
|
||||||
|
// Highlight a range
|
||||||
|
if( typeof highlight.end === 'number' ) {
|
||||||
|
elementsToHighlight = [].slice.call( block.querySelectorAll( 'table tr:nth-child(n+'+highlight.start+'):nth-child(-n+'+highlight.end+')' ) );
|
||||||
|
}
|
||||||
|
// Highlight a single line
|
||||||
|
else if( typeof highlight.start === 'number' ) {
|
||||||
|
elementsToHighlight = [].slice.call( block.querySelectorAll( 'table tr:nth-child('+highlight.start+')' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( elementsToHighlight.length ) {
|
||||||
|
elementsToHighlight.forEach( function( lineElement ) {
|
||||||
|
lineElement.classList.add( 'highlight-line' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
block.removeAttribute( 'data-fragment-index' )
|
block.classList.add( 'has-highlights' );
|
||||||
block.setAttribute( 'data-line-numbers', RevealHighlight.serializeHighlightSteps( [ highlightSteps[0] ] ) );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scroll the first highlight into view when the slide
|
|
||||||
// becomes visible. Note supported in IE11 since it lacks
|
|
||||||
// support for Element.closest.
|
|
||||||
var slide = typeof block.closest === 'function' ? block.closest( 'section:not(.stack)' ) : null;
|
|
||||||
if( slide ) {
|
|
||||||
var scrollFirstHighlightIntoView = function() {
|
|
||||||
RevealHighlight.scrollHighlightedLineIntoView( block, scrollState, true );
|
|
||||||
slide.removeEventListener( 'visible', scrollFirstHighlightIntoView );
|
|
||||||
}
|
|
||||||
slide.addEventListener( 'visible', scrollFirstHighlightIntoView );
|
|
||||||
}
|
|
||||||
|
|
||||||
RevealHighlight.highlightLines( block );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Animates scrolling to the first highlighted line
|
|
||||||
* in the given code block.
|
|
||||||
*/
|
|
||||||
scrollHighlightedLineIntoView: function( block, scrollState, skipAnimation ) {
|
|
||||||
|
|
||||||
cancelAnimationFrame( scrollState.animationFrameID );
|
|
||||||
|
|
||||||
// Match the scroll position of the currently visible
|
|
||||||
// code block
|
|
||||||
if( scrollState.currentBlock ) {
|
|
||||||
block.scrollTop = scrollState.currentBlock.scrollTop;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remember the current code block so that we can match
|
|
||||||
// its scroll position when showing/hiding fragments
|
|
||||||
scrollState.currentBlock = block;
|
|
||||||
|
|
||||||
var highlightBounds = this.getHighlightedLineBounds( block )
|
|
||||||
var viewportHeight = block.offsetHeight;
|
|
||||||
|
|
||||||
// Subtract padding from the viewport height
|
|
||||||
var blockStyles = getComputedStyle( block );
|
|
||||||
viewportHeight -= parseInt( blockStyles.paddingTop ) + parseInt( blockStyles.paddingBottom );
|
|
||||||
|
|
||||||
// Scroll position which centers all highlights
|
|
||||||
var startTop = block.scrollTop;
|
|
||||||
var targetTop = highlightBounds.top + ( Math.min( highlightBounds.bottom - highlightBounds.top, viewportHeight ) - viewportHeight ) / 2;
|
|
||||||
|
|
||||||
// Account for offsets in position applied to the
|
|
||||||
// <table> that holds our lines of code
|
|
||||||
var lineTable = block.querySelector( '.hljs-ln' );
|
|
||||||
if( lineTable ) targetTop += lineTable.offsetTop - parseInt( blockStyles.paddingTop );
|
|
||||||
|
|
||||||
// Make sure the scroll target is within bounds
|
|
||||||
targetTop = Math.max( Math.min( targetTop, block.scrollHeight - viewportHeight ), 0 );
|
|
||||||
|
|
||||||
if( skipAnimation === true || startTop === targetTop ) {
|
|
||||||
block.scrollTop = targetTop;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
// Don't attempt to scroll if there is no overflow
|
|
||||||
if( block.scrollHeight <= viewportHeight ) return;
|
|
||||||
|
|
||||||
var time = 0;
|
|
||||||
var animate = function() {
|
|
||||||
time = Math.min( time + 0.02, 1 );
|
|
||||||
|
|
||||||
// Update our eased scroll position
|
|
||||||
block.scrollTop = startTop + ( targetTop - startTop ) * RevealHighlight.easeInOutQuart( time );
|
|
||||||
|
|
||||||
// Keep animating unless we've reached the end
|
|
||||||
if( time < 1 ) {
|
|
||||||
scrollState.animationFrameID = requestAnimationFrame( animate );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
animate();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The easing function used when scrolling.
|
|
||||||
*/
|
|
||||||
easeInOutQuart: function( t ) {
|
|
||||||
|
|
||||||
// easeInOutQuart
|
|
||||||
return t<.5 ? 8*t*t*t*t : 1-8*(--t)*t*t*t;
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
getHighlightedLineBounds: function( block ) {
|
|
||||||
|
|
||||||
var highlightedLines = block.querySelectorAll( '.highlight-line' );
|
|
||||||
if( highlightedLines.length === 0 ) {
|
|
||||||
return { top: 0, bottom: 0 };
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var firstHighlight = highlightedLines[0];
|
|
||||||
var lastHighlight = highlightedLines[ highlightedLines.length -1 ];
|
|
||||||
|
|
||||||
return {
|
|
||||||
top: firstHighlight.offsetTop,
|
|
||||||
bottom: lastHighlight.offsetTop + lastHighlight.offsetHeight
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Visually emphasize specific lines within a code block.
|
|
||||||
* This only works on blocks with line numbering turned on.
|
|
||||||
*
|
|
||||||
* @param {HTMLElement} block a <code> block
|
|
||||||
* @param {String} [linesToHighlight] The lines that should be
|
|
||||||
* highlighted in this format:
|
|
||||||
* "1" = highlights line 1
|
|
||||||
* "2,5" = highlights lines 2 & 5
|
|
||||||
* "2,5-7" = highlights lines 2, 5, 6 & 7
|
|
||||||
*/
|
|
||||||
highlightLines: function( block, linesToHighlight ) {
|
|
||||||
|
|
||||||
var highlightSteps = RevealHighlight.deserializeHighlightSteps( linesToHighlight || block.getAttribute( 'data-line-numbers' ) );
|
|
||||||
|
|
||||||
if( highlightSteps.length ) {
|
|
||||||
|
|
||||||
highlightSteps[0].forEach( function( highlight ) {
|
|
||||||
|
|
||||||
var elementsToHighlight = [];
|
|
||||||
|
|
||||||
// Highlight a range
|
|
||||||
if( typeof highlight.end === 'number' ) {
|
|
||||||
elementsToHighlight = [].slice.call( block.querySelectorAll( 'table tr:nth-child(n+'+highlight.start+'):nth-child(-n+'+highlight.end+')' ) );
|
|
||||||
}
|
|
||||||
// Highlight a single line
|
|
||||||
else if( typeof highlight.start === 'number' ) {
|
|
||||||
elementsToHighlight = [].slice.call( block.querySelectorAll( 'table tr:nth-child('+highlight.start+')' ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( elementsToHighlight.length ) {
|
|
||||||
elementsToHighlight.forEach( function( lineElement ) {
|
|
||||||
lineElement.classList.add( 'highlight-line' );
|
|
||||||
} );
|
|
||||||
|
|
||||||
block.classList.add( 'has-highlights' );
|
|
||||||
}
|
|
||||||
|
|
||||||
} );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses and formats a user-defined string of line
|
|
||||||
* numbers to highlight.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* RevealHighlight.deserializeHighlightSteps( '1,2|3,5-10' )
|
|
||||||
* // [
|
|
||||||
* // [ { start: 1 }, { start: 2 } ],
|
|
||||||
* // [ { start: 3 }, { start: 5, end: 10 } ]
|
|
||||||
* // ]
|
|
||||||
*/
|
|
||||||
deserializeHighlightSteps: function( highlightSteps ) {
|
|
||||||
|
|
||||||
// Remove whitespace
|
|
||||||
highlightSteps = highlightSteps.replace( /\s/g, '' );
|
|
||||||
|
|
||||||
// Divide up our line number groups
|
|
||||||
highlightSteps = highlightSteps.split( RevealHighlight.HIGHLIGHT_STEP_DELIMITER );
|
|
||||||
|
|
||||||
return highlightSteps.map( function( highlights ) {
|
|
||||||
|
|
||||||
return highlights.split( RevealHighlight.HIGHLIGHT_LINE_DELIMITER ).map( function( highlight ) {
|
|
||||||
|
|
||||||
// Parse valid line numbers
|
|
||||||
if( /^[\d-]+$/.test( highlight ) ) {
|
|
||||||
|
|
||||||
highlight = highlight.split( RevealHighlight.HIGHLIGHT_LINE_RANGE_DELIMITER );
|
|
||||||
|
|
||||||
var lineStart = parseInt( highlight[0], 10 ),
|
|
||||||
lineEnd = parseInt( highlight[1], 10 );
|
|
||||||
|
|
||||||
if( isNaN( lineEnd ) ) {
|
|
||||||
return {
|
|
||||||
start: lineStart
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return {
|
|
||||||
start: lineStart,
|
|
||||||
end: lineEnd
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
// If no line numbers are provided, no code will be highlighted
|
|
||||||
else {
|
|
||||||
|
|
||||||
return {};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} );
|
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Serializes parsed line number data into a string so
|
|
||||||
* that we can store it in the DOM.
|
|
||||||
*/
|
|
||||||
serializeHighlightSteps: function( highlightSteps ) {
|
|
||||||
|
|
||||||
return highlightSteps.map( function( highlights ) {
|
|
||||||
|
|
||||||
return highlights.map( function( highlight ) {
|
|
||||||
|
|
||||||
// Line range
|
|
||||||
if( typeof highlight.end === 'number' ) {
|
|
||||||
return highlight.start + RevealHighlight.HIGHLIGHT_LINE_RANGE_DELIMITER + highlight.end;
|
|
||||||
}
|
|
||||||
// Single line
|
|
||||||
else if( typeof highlight.start === 'number' ) {
|
|
||||||
return highlight.start;
|
|
||||||
}
|
|
||||||
// All lines
|
|
||||||
else {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
} ).join( RevealHighlight.HIGHLIGHT_LINE_DELIMITER );
|
|
||||||
|
|
||||||
} ).join( RevealHighlight.HIGHLIGHT_STEP_DELIMITER );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses and formats a user-defined string of line
|
||||||
|
* numbers to highlight.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* RevealHighlight.deserializeHighlightSteps( '1,2|3,5-10' )
|
||||||
|
* // [
|
||||||
|
* // [ { start: 1 }, { start: 2 } ],
|
||||||
|
* // [ { start: 3 }, { start: 5, end: 10 } ]
|
||||||
|
* // ]
|
||||||
|
*/
|
||||||
|
deserializeHighlightSteps: function( highlightSteps ) {
|
||||||
|
|
||||||
|
// Remove whitespace
|
||||||
|
highlightSteps = highlightSteps.replace( /\s/g, '' );
|
||||||
|
|
||||||
|
// Divide up our line number groups
|
||||||
|
highlightSteps = highlightSteps.split( RevealHighlight.HIGHLIGHT_STEP_DELIMITER );
|
||||||
|
|
||||||
|
return highlightSteps.map( function( highlights ) {
|
||||||
|
|
||||||
|
return highlights.split( RevealHighlight.HIGHLIGHT_LINE_DELIMITER ).map( function( highlight ) {
|
||||||
|
|
||||||
|
// Parse valid line numbers
|
||||||
|
if( /^[\d-]+$/.test( highlight ) ) {
|
||||||
|
|
||||||
|
highlight = highlight.split( RevealHighlight.HIGHLIGHT_LINE_RANGE_DELIMITER );
|
||||||
|
|
||||||
|
var lineStart = parseInt( highlight[0], 10 ),
|
||||||
|
lineEnd = parseInt( highlight[1], 10 );
|
||||||
|
|
||||||
|
if( isNaN( lineEnd ) ) {
|
||||||
|
return {
|
||||||
|
start: lineStart
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return {
|
||||||
|
start: lineStart,
|
||||||
|
end: lineEnd
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// If no line numbers are provided, no code will be highlighted
|
||||||
|
else {
|
||||||
|
|
||||||
|
return {};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serializes parsed line number data into a string so
|
||||||
|
* that we can store it in the DOM.
|
||||||
|
*/
|
||||||
|
serializeHighlightSteps: function( highlightSteps ) {
|
||||||
|
|
||||||
|
return highlightSteps.map( function( highlights ) {
|
||||||
|
|
||||||
|
return highlights.map( function( highlight ) {
|
||||||
|
|
||||||
|
// Line range
|
||||||
|
if( typeof highlight.end === 'number' ) {
|
||||||
|
return highlight.start + RevealHighlight.HIGHLIGHT_LINE_RANGE_DELIMITER + highlight.end;
|
||||||
|
}
|
||||||
|
// Single line
|
||||||
|
else if( typeof highlight.start === 'number' ) {
|
||||||
|
return highlight.start;
|
||||||
|
}
|
||||||
|
// All lines
|
||||||
|
else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
} ).join( RevealHighlight.HIGHLIGHT_LINE_DELIMITER );
|
||||||
|
|
||||||
|
} ).join( RevealHighlight.HIGHLIGHT_STEP_DELIMITER );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Reveal.registerPlugin( RevealHighlight );
|
}
|
||||||
|
|
||||||
return RevealHighlight;
|
export default RevealHighlight;
|
||||||
|
|
||||||
}));
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* This is used to compile a self-registering
|
||||||
|
* es5 compatible version of the plugin.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import plugin from './markdown.js'
|
||||||
|
Reveal.registerPlugin( plugin );
|
||||||
+392
-411
@@ -1,449 +1,430 @@
|
|||||||
/**
|
/*!
|
||||||
* The reveal.js markdown plugin. Handles parsing of
|
* The reveal.js markdown plugin. Handles parsing of
|
||||||
* markdown inside of presentations as well as loading
|
* markdown inside of presentations as well as loading
|
||||||
* of external markdown documents.
|
* of external markdown documents.
|
||||||
*/
|
*/
|
||||||
(function( root, factory ) {
|
|
||||||
if (typeof define === 'function' && define.amd) {
|
|
||||||
root.marked = require( './marked' );
|
|
||||||
root.RevealMarkdown = factory( root.marked );
|
|
||||||
} else if( typeof exports === 'object' ) {
|
|
||||||
module.exports = factory( require( './marked' ) );
|
|
||||||
} else {
|
|
||||||
// Browser globals (root is window)
|
|
||||||
root.RevealMarkdown = factory( root.marked );
|
|
||||||
}
|
|
||||||
}( this, function( marked ) {
|
|
||||||
|
|
||||||
var DEFAULT_SLIDE_SEPARATOR = '^\r?\n---\r?\n$',
|
import marked from './marked.js'
|
||||||
DEFAULT_NOTES_SEPARATOR = 'notes?:',
|
|
||||||
DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR = '\\\.element\\\s*?(.+?)$',
|
|
||||||
DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR = '\\\.slide:\\\s*?(\\\S.+?)$';
|
|
||||||
|
|
||||||
var SCRIPT_END_PLACEHOLDER = '__SCRIPT_END__';
|
export default {
|
||||||
|
|
||||||
|
id: 'markdown',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the markdown contents of a slide section
|
* Starts processing and converting Markdown within the
|
||||||
* element. Normalizes leading tabs/whitespace.
|
* current reveal.js deck.
|
||||||
*/
|
*/
|
||||||
function getMarkdownFromSlide( section ) {
|
init: function( deck ) {
|
||||||
|
|
||||||
// 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;
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
|
|
||||||
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 = [];
|
|
||||||
|
|
||||||
for( var i = 0, len = attributes.length; i < len; i++ ) {
|
|
||||||
var name = attributes[i].name,
|
|
||||||
value = attributes[i].value;
|
|
||||||
|
|
||||||
// disregard attributes that are used for markdown loading/parsing
|
|
||||||
if( /data\-(markdown|separator|vertical|notes)/gi.test( name ) ) continue;
|
|
||||||
|
|
||||||
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 || '';
|
|
||||||
|
|
||||||
return options;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper function for constructing a markdown slide.
|
|
||||||
*/
|
|
||||||
function createMarkdownSlide( content, options ) {
|
|
||||||
|
|
||||||
options = getSlidifyOptions( options );
|
|
||||||
|
|
||||||
var notesMatch = content.split( new RegExp( options.notesSeparator, 'mgi' ) );
|
|
||||||
|
|
||||||
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 );
|
|
||||||
|
|
||||||
return '<script type="text/template">' + content + '</script>';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses a data string into multiple slides based
|
|
||||||
* on the passed in separator arguments.
|
|
||||||
*/
|
|
||||||
function slidify( markdown, options ) {
|
|
||||||
|
|
||||||
options = getSlidifyOptions( options );
|
|
||||||
|
|
||||||
var separatorRegex = new RegExp( options.separator + ( options.verticalSeparator ? '|' + options.verticalSeparator : '' ), 'mg' ),
|
|
||||||
horizontalSeparatorRegex = new RegExp( options.separator );
|
|
||||||
|
|
||||||
var matches,
|
|
||||||
lastIndex = 0,
|
|
||||||
isHorizontal,
|
|
||||||
wasHorizontal = true,
|
|
||||||
content,
|
|
||||||
sectionStack = [];
|
|
||||||
|
|
||||||
// iterate until all blocks between separators are stacked up
|
|
||||||
while( matches = separatorRegex.exec( markdown ) ) {
|
|
||||||
notes = null;
|
|
||||||
|
|
||||||
// determine direction (horizontal by default)
|
|
||||||
isHorizontal = horizontalSeparatorRegex.test( matches[0] );
|
|
||||||
|
|
||||||
if( !isHorizontal && wasHorizontal ) {
|
|
||||||
// create vertical stack
|
|
||||||
sectionStack.push( [] );
|
|
||||||
}
|
|
||||||
|
|
||||||
// pluck slide content from markdown input
|
|
||||||
content = markdown.substring( lastIndex, matches.index );
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// add the remaining slide
|
|
||||||
( wasHorizontal ? sectionStack : sectionStack[sectionStack.length-1] ).push( markdown.substring( lastIndex ) );
|
|
||||||
|
|
||||||
var markdownSections = '';
|
|
||||||
|
|
||||||
// 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 +'>';
|
|
||||||
|
|
||||||
sectionStack[i].forEach( function( child ) {
|
|
||||||
markdownSections += '<section data-markdown>' + createMarkdownSlide( child, options ) + '</section>';
|
|
||||||
} );
|
|
||||||
|
|
||||||
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() {
|
|
||||||
|
|
||||||
return new Promise( function( resolve ) {
|
|
||||||
|
|
||||||
var externalPromises = [];
|
|
||||||
|
|
||||||
[].slice.call( document.querySelectorAll( '[data-markdown]') ).forEach( function( section, i ) {
|
|
||||||
|
|
||||||
if( section.getAttribute( 'data-markdown' ).length ) {
|
|
||||||
|
|
||||||
externalPromises.push( loadExternalMarkdown( section ).then(
|
|
||||||
|
|
||||||
// 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>';
|
|
||||||
}
|
|
||||||
|
|
||||||
) );
|
|
||||||
|
|
||||||
|
if( typeof hljs !== 'undefined' ) {
|
||||||
|
marked.setOptions({
|
||||||
|
highlight: function( code, lang ) {
|
||||||
|
return hljs.highlightAuto( code, [lang] ).value;
|
||||||
}
|
}
|
||||||
else if( section.getAttribute( 'data-separator' ) || section.getAttribute( 'data-separator-vertical' ) || section.getAttribute( 'data-separator-notes' ) ) {
|
});
|
||||||
|
}
|
||||||
|
|
||||||
section.outerHTML = slidify( getMarkdownFromSlide( section ), {
|
// marked can be configured via reveal.js config options
|
||||||
separator: section.getAttribute( 'data-separator' ),
|
var options = deck.getConfig().markdown;
|
||||||
verticalSeparator: section.getAttribute( 'data-separator-vertical' ),
|
if( options ) {
|
||||||
notesSeparator: section.getAttribute( 'data-separator-notes' ),
|
marked.setOptions( options );
|
||||||
attributes: getForwardedAttributes( section )
|
}
|
||||||
});
|
|
||||||
|
return processSlides( deck.getRevealElement() ).then( convertSlides );
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
// TODO: Do these belong in the API?
|
||||||
|
processSlides: processSlides,
|
||||||
|
convertSlides: convertSlides,
|
||||||
|
slidify: slidify,
|
||||||
|
marked: marked
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
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.+?)$';
|
||||||
|
|
||||||
|
var SCRIPT_END_PLACEHOLDER = '__SCRIPT_END__';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the markdown contents of a slide section
|
||||||
|
* element. Normalizes leading tabs/whitespace.
|
||||||
|
*/
|
||||||
|
function getMarkdownFromSlide( section ) {
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
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 = [];
|
||||||
|
|
||||||
|
for( var i = 0, len = attributes.length; i < len; i++ ) {
|
||||||
|
var name = attributes[i].name,
|
||||||
|
value = attributes[i].value;
|
||||||
|
|
||||||
|
// disregard attributes that are used for markdown loading/parsing
|
||||||
|
if( /data\-(markdown|separator|vertical|notes)/gi.test( name ) ) continue;
|
||||||
|
|
||||||
|
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 || '';
|
||||||
|
|
||||||
|
return options;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function for constructing a markdown slide.
|
||||||
|
*/
|
||||||
|
function createMarkdownSlide( content, options ) {
|
||||||
|
|
||||||
|
options = getSlidifyOptions( options );
|
||||||
|
|
||||||
|
var notesMatch = content.split( new RegExp( options.notesSeparator, 'mgi' ) );
|
||||||
|
|
||||||
|
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 );
|
||||||
|
|
||||||
|
return '<script type="text/template">' + content + '</script>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses a data string into multiple slides based
|
||||||
|
* on the passed in separator arguments.
|
||||||
|
*/
|
||||||
|
function slidify( markdown, options ) {
|
||||||
|
|
||||||
|
options = getSlidifyOptions( options );
|
||||||
|
|
||||||
|
var separatorRegex = new RegExp( options.separator + ( options.verticalSeparator ? '|' + options.verticalSeparator : '' ), 'mg' ),
|
||||||
|
horizontalSeparatorRegex = new RegExp( options.separator );
|
||||||
|
|
||||||
|
var matches,
|
||||||
|
lastIndex = 0,
|
||||||
|
isHorizontal,
|
||||||
|
wasHorizontal = true,
|
||||||
|
content,
|
||||||
|
sectionStack = [];
|
||||||
|
|
||||||
|
// iterate until all blocks between separators are stacked up
|
||||||
|
while( matches = separatorRegex.exec( markdown ) ) {
|
||||||
|
var notes = null;
|
||||||
|
|
||||||
|
// determine direction (horizontal by default)
|
||||||
|
isHorizontal = horizontalSeparatorRegex.test( matches[0] );
|
||||||
|
|
||||||
|
if( !isHorizontal && wasHorizontal ) {
|
||||||
|
// create vertical stack
|
||||||
|
sectionStack.push( [] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// pluck slide content from markdown input
|
||||||
|
content = markdown.substring( lastIndex, matches.index );
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the remaining slide
|
||||||
|
( wasHorizontal ? sectionStack : sectionStack[sectionStack.length-1] ).push( markdown.substring( lastIndex ) );
|
||||||
|
|
||||||
|
var markdownSections = '';
|
||||||
|
|
||||||
|
// 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 +'>';
|
||||||
|
|
||||||
|
sectionStack[i].forEach( function( child ) {
|
||||||
|
markdownSections += '<section data-markdown>' + createMarkdownSlide( child, options ) + '</section>';
|
||||||
|
} );
|
||||||
|
|
||||||
|
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 ) {
|
||||||
|
|
||||||
|
var externalPromises = [];
|
||||||
|
|
||||||
|
[].slice.call( scope.querySelectorAll( '[data-markdown]:not([data-markdown-parsed])') ).forEach( function( section, i ) {
|
||||||
|
|
||||||
|
if( section.getAttribute( 'data-markdown' ).length ) {
|
||||||
|
|
||||||
|
externalPromises.push( loadExternalMarkdown( section ).then(
|
||||||
|
|
||||||
|
// 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 {
|
||||||
|
section.innerHTML = createMarkdownSlide( getMarkdownFromSlide( section ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Promise.all( externalPromises ).then( resolve );
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadExternalMarkdown( section ) {
|
||||||
|
|
||||||
|
return new Promise( function( resolve, reject ) {
|
||||||
|
|
||||||
|
var xhr = new XMLHttpRequest(),
|
||||||
|
url = section.getAttribute( 'data-markdown' );
|
||||||
|
|
||||||
|
var datacharset = section.getAttribute( 'data-charset' );
|
||||||
|
|
||||||
|
// see https://developer.mozilla.org/en-US/docs/Web/API/element.getAttribute#Notes
|
||||||
|
if( datacharset != null && datacharset != '' ) {
|
||||||
|
xhr.overrideMimeType( 'text/html; charset=' + datacharset );
|
||||||
|
}
|
||||||
|
|
||||||
|
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 ) {
|
||||||
|
|
||||||
|
resolve( xhr, url );
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
section.innerHTML = createMarkdownSlide( getMarkdownFromSlide( section ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
reject( xhr, url );
|
||||||
|
|
||||||
Promise.all( externalPromises ).then( resolve );
|
|
||||||
|
|
||||||
} );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadExternalMarkdown( section ) {
|
|
||||||
|
|
||||||
return new Promise( function( resolve, reject ) {
|
|
||||||
|
|
||||||
var xhr = new XMLHttpRequest(),
|
|
||||||
url = section.getAttribute( 'data-markdown' );
|
|
||||||
|
|
||||||
datacharset = section.getAttribute( 'data-charset' );
|
|
||||||
|
|
||||||
// see https://developer.mozilla.org/en-US/docs/Web/API/element.getAttribute#Notes
|
|
||||||
if( datacharset != null && datacharset != '' ) {
|
|
||||||
xhr.overrideMimeType( 'text/html; charset=' + datacharset );
|
|
||||||
}
|
|
||||||
|
|
||||||
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 ) {
|
|
||||||
|
|
||||||
resolve( xhr, url );
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
reject( xhr, url );
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.bind( this, section, xhr );
|
|
||||||
|
|
||||||
xhr.open( 'GET', url, true );
|
|
||||||
|
|
||||||
try {
|
|
||||||
xhr.send();
|
|
||||||
}
|
|
||||||
catch ( e ) {
|
|
||||||
alert( '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 ) {
|
|
||||||
|
|
||||||
var mardownClassesInElementsRegex = new RegExp( separator, 'mg' );
|
|
||||||
var mardownClassRegex = new RegExp( "([^\"= ]+?)=\"([^\"]+?)\"|(data-[^\"= ]+?)(?=[\" ])", 'mg' );
|
|
||||||
var nodeValue = node.nodeValue;
|
|
||||||
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], "" );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
}.bind( this, section, xhr );
|
||||||
|
|
||||||
|
xhr.open( 'GET', url, true );
|
||||||
|
|
||||||
|
try {
|
||||||
|
xhr.send();
|
||||||
}
|
}
|
||||||
return false;
|
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 );
|
||||||
/**
|
|
||||||
* 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 ) {
|
|
||||||
previousParentElement = element;
|
|
||||||
for( var i = 0; i < element.childNodes.length; i++ ) {
|
|
||||||
childElement = element.childNodes[i];
|
|
||||||
if ( i > 0 ) {
|
|
||||||
j = i - 1;
|
|
||||||
while ( j >= 0 ) {
|
|
||||||
aPreviousChildElement = element.childNodes[j];
|
|
||||||
if ( typeof aPreviousChildElement.setAttribute == 'function' && aPreviousChildElement.tagName != "BR" ) {
|
|
||||||
previousParentElement = aPreviousChildElement;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
j = j - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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 );
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 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 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 ) {
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 ) {
|
||||||
* Converts any current data-markdown slides in the
|
if ( addAttributeInElement( element, previousElement, separatorElementAttributes ) == false ) {
|
||||||
* DOM to HTML.
|
addAttributeInElement( element, section, separatorSectionAttributes );
|
||||||
*/
|
}
|
||||||
function convertSlides() {
|
|
||||||
|
|
||||||
var sections = document.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();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// API
|
/**
|
||||||
var RevealMarkdown = {
|
* Converts any current data-markdown slides in the
|
||||||
|
* DOM to HTML.
|
||||||
|
*/
|
||||||
|
function convertSlides() {
|
||||||
|
|
||||||
id: 'markdown',
|
var sections = document.querySelectorAll( '[data-markdown]:not([data-markdown-parsed])');
|
||||||
|
|
||||||
/**
|
[].slice.call( sections ).forEach( function( section ) {
|
||||||
* Starts processing and converting Markdown within the
|
|
||||||
* current reveal.js deck.
|
|
||||||
*/
|
|
||||||
init: function( deck ) {
|
|
||||||
|
|
||||||
if( typeof marked === 'undefined' ) {
|
section.setAttribute( 'data-markdown-parsed', true )
|
||||||
throw 'The reveal.js Markdown plugin requires marked to be loaded';
|
|
||||||
}
|
|
||||||
|
|
||||||
if( typeof hljs !== 'undefined' ) {
|
var notes = section.querySelector( 'aside.notes' );
|
||||||
marked.setOptions({
|
var markdown = getMarkdownFromSlide( section );
|
||||||
highlight: function( code, lang ) {
|
|
||||||
return hljs.highlightAuto( code, [lang] ).value;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// marked can be configured via reveal.js config options
|
section.innerHTML = marked( markdown );
|
||||||
var options = deck.getConfig().markdown;
|
addAttributes( section, section, null, section.getAttribute( 'data-element-attributes' ) ||
|
||||||
if( options ) {
|
section.parentNode.getAttribute( 'data-element-attributes' ) ||
|
||||||
marked.setOptions( options );
|
DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR,
|
||||||
}
|
section.getAttribute( 'data-attributes' ) ||
|
||||||
|
section.parentNode.getAttribute( 'data-attributes' ) ||
|
||||||
|
DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR);
|
||||||
|
|
||||||
return processSlides().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?
|
return Promise.resolve();
|
||||||
processSlides: processSlides,
|
|
||||||
convertSlides: convertSlides,
|
|
||||||
slidify: slidify
|
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
// Register our plugin so that reveal.js will call our
|
|
||||||
// plugin 'init' method as part of the initialization
|
|
||||||
Reveal.registerPlugin( RevealMarkdown );
|
|
||||||
|
|
||||||
return RevealMarkdown;
|
|
||||||
|
|
||||||
}));
|
|
||||||
+2052
-2
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* This is used to compile a self-registering
|
||||||
|
* es5 compatible version of the plugin.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import plugin from './math.js'
|
||||||
|
Reveal.registerPlugin( plugin );
|
||||||
+2
-2
@@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @author Hakim El Hattab
|
* @author Hakim El Hattab
|
||||||
*/
|
*/
|
||||||
var RevealMath = window.RevealMath || (function(){
|
var RevealMath = (function(){
|
||||||
|
|
||||||
var options = Reveal.getConfig().math || {};
|
var options = Reveal.getConfig().math || {};
|
||||||
var mathjax = options.mathjax || 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js';
|
var mathjax = options.mathjax || 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js';
|
||||||
@@ -91,4 +91,4 @@ var RevealMath = window.RevealMath || (function(){
|
|||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
Reveal.registerPlugin( RevealMath );
|
export default RevealMath;
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* This is used to compile a self-registering
|
||||||
|
* es5 compatible version of the plugin.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import plugin from './notes.js'
|
||||||
|
Reveal.registerPlugin( plugin );
|
||||||
@@ -23,9 +23,10 @@ var RevealNotes = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( !notesFilePath ) {
|
if( !notesFilePath ) {
|
||||||
var jsFileLocation = document.querySelector('script[src$="notes.js"]').src; // this js file path
|
// var jsFileLocation = document.querySelector('script[src$="notes.js"]').src; // this js file path
|
||||||
jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, ''); // the js folder path
|
// jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, ''); // the js folder path
|
||||||
notesFilePath = jsFileLocation + 'notes.html';
|
// notesFilePath = jsFileLocation + 'notes.html';
|
||||||
|
notesFilePath = 'plugin/notes/notes.html'
|
||||||
}
|
}
|
||||||
|
|
||||||
notesPopup = window.open( notesFilePath, 'reveal.js - Notes', 'width=1100,height=700' );
|
notesPopup = window.open( notesFilePath, 'reveal.js - Notes', 'width=1100,height=700' );
|
||||||
@@ -156,9 +157,9 @@ var RevealNotes = (function() {
|
|||||||
return {
|
return {
|
||||||
id: 'notes',
|
id: 'notes',
|
||||||
|
|
||||||
init: function( revealInstance ) {
|
init: function( reveal ) {
|
||||||
|
|
||||||
deck = revealInstance;
|
deck = reveal;
|
||||||
|
|
||||||
if( !/receiver/i.test( window.location.search ) ) {
|
if( !/receiver/i.test( window.location.search ) ) {
|
||||||
|
|
||||||
@@ -181,4 +182,4 @@ var RevealNotes = (function() {
|
|||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
Reveal.registerPlugin( RevealNotes );
|
export default RevealNotes;
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* This is used to compile a self-registering
|
||||||
|
* es5 compatible version of the plugin.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import plugin from './search.js'
|
||||||
|
Reveal.registerPlugin( plugin );
|
||||||
+17
-2
@@ -200,7 +200,22 @@ function Hilitor(id, tag)
|
|||||||
toggleSearch();
|
toggleSearch();
|
||||||
}
|
}
|
||||||
}, false );
|
}, false );
|
||||||
if( window.Reveal ) Reveal.registerKeyboardShortcut( 'CTRL + Shift + F', 'Search' );
|
|
||||||
closeSearch();
|
closeSearch();
|
||||||
return { open: openSearch };
|
|
||||||
|
return {
|
||||||
|
|
||||||
|
id: 'search',
|
||||||
|
|
||||||
|
init: reveal => {
|
||||||
|
|
||||||
|
reveal.registerKeyboardShortcut( 'CTRL + Shift + F', 'Search' );
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
open: openSearch
|
||||||
|
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
export default RevealSearch;
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* This is used to compile a self-registering
|
||||||
|
* es5 compatible version of the plugin.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import plugin from './zoom.js'
|
||||||
|
Reveal.registerPlugin( plugin );
|
||||||
@@ -1,35 +1,33 @@
|
|||||||
// Custom reveal.js integration
|
/*!
|
||||||
var RevealZoom = (function(){
|
* reveal.js Zoom plugin
|
||||||
|
*/
|
||||||
|
export default {
|
||||||
|
|
||||||
return {
|
id: 'zoom',
|
||||||
id: 'zoom',
|
|
||||||
|
|
||||||
init: function( reveal ) {
|
init: function( reveal ) {
|
||||||
|
|
||||||
reveal.getRevealElement().addEventListener( 'mousedown', function( event ) {
|
reveal.getRevealElement().addEventListener( 'mousedown', function( event ) {
|
||||||
var defaultModifier = /Linux/.test( window.navigator.platform ) ? 'ctrl' : 'alt';
|
var defaultModifier = /Linux/.test( window.navigator.platform ) ? 'ctrl' : 'alt';
|
||||||
|
|
||||||
var modifier = ( reveal.getConfig().zoomKey ? reveal.getConfig().zoomKey : defaultModifier ) + 'Key';
|
var modifier = ( reveal.getConfig().zoomKey ? reveal.getConfig().zoomKey : defaultModifier ) + 'Key';
|
||||||
var zoomLevel = ( reveal.getConfig().zoomLevel ? reveal.getConfig().zoomLevel : 2 );
|
var zoomLevel = ( reveal.getConfig().zoomLevel ? reveal.getConfig().zoomLevel : 2 );
|
||||||
|
|
||||||
if( event[ modifier ] && !reveal.isOverview() ) {
|
if( event[ modifier ] && !reveal.isOverview() ) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
zoom.to({
|
zoom.to({
|
||||||
x: event.clientX,
|
x: event.clientX,
|
||||||
y: event.clientY,
|
y: event.clientY,
|
||||||
scale: zoomLevel,
|
scale: zoomLevel,
|
||||||
pan: false
|
pan: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
};
|
||||||
|
|
||||||
Reveal.registerPlugin( RevealZoom );
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* zoom.js 0.3 (modified for use with reveal.js)
|
* zoom.js 0.3 (modified for use with reveal.js)
|
||||||
@@ -195,7 +195,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
dependencies: [
|
dependencies: [
|
||||||
{ src: '../../plugin/math/math.js', async: true }
|
{ src: '../../dist/plugin/math.js', async: true }
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,11 @@
|
|||||||
<div style="display: flex; flex-direction: row;">
|
<div style="display: flex; flex-direction: row;">
|
||||||
<div class="reveal deck1" style="width: 100%; height: 50vh; margin: 10px;">
|
<div class="reveal deck1" style="width: 100%; height: 50vh; margin: 10px;">
|
||||||
<div class="slides">
|
<div class="slides">
|
||||||
<section>1.1</section>
|
<section data-markdown>
|
||||||
|
<script type="text/template">
|
||||||
|
## Slide attributes
|
||||||
|
</script>
|
||||||
|
</section>
|
||||||
<section>1.2</section>
|
<section>1.2</section>
|
||||||
<section>1.3</section>
|
<section>1.3</section>
|
||||||
</div>
|
</div>
|
||||||
@@ -25,7 +29,11 @@
|
|||||||
|
|
||||||
<div class="reveal deck2" style="width: 100%; height: 50vh; margin: 10px;">
|
<div class="reveal deck2" style="width: 100%; height: 50vh; margin: 10px;">
|
||||||
<div class="slides">
|
<div class="slides">
|
||||||
<section>2.1</section>
|
<section data-markdown>
|
||||||
|
<script type="text/template">
|
||||||
|
## Slide attributes
|
||||||
|
</script>
|
||||||
|
</section>
|
||||||
<section>2.2</section>
|
<section>2.2</section>
|
||||||
<section>2.3</section>
|
<section>2.3</section>
|
||||||
</div>
|
</div>
|
||||||
@@ -34,19 +42,24 @@
|
|||||||
|
|
||||||
<script src="../../dist/reveal.min.js"></script>
|
<script src="../../dist/reveal.min.js"></script>
|
||||||
|
|
||||||
<script>
|
<script type="module">
|
||||||
|
|
||||||
|
import Markdown from '../../plugin/markdown/markdown.js';
|
||||||
|
|
||||||
let r1 = new Reveal( document.querySelector( '.deck1' ), {
|
let r1 = new Reveal( document.querySelector( '.deck1' ), {
|
||||||
embedded: true,
|
embedded: true,
|
||||||
keyboard: false
|
keyboard: false
|
||||||
} );
|
} );
|
||||||
r1.initialize();
|
r1.initialize().then( () => {
|
||||||
|
|
||||||
|
let r2 = new Reveal( document.querySelector( '.deck2' ), {
|
||||||
|
embedded: true,
|
||||||
|
keyboard: false,
|
||||||
|
dependencies: [{plugin: Markdown}]
|
||||||
|
} );
|
||||||
|
r2.initialize();
|
||||||
|
|
||||||
let r2 = new Reveal( document.querySelector( '.deck2' ), {
|
|
||||||
embedded: true,
|
|
||||||
keyboard: false
|
|
||||||
} );
|
} );
|
||||||
r2.initialize();
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -122,13 +122,12 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="../dist/reveal.min.js"></script>
|
<script type="module">
|
||||||
<script>
|
import '../js/index.js'
|
||||||
|
import Markdown from '../plugin/markdown/markdown.js'
|
||||||
|
|
||||||
Reveal.initialize({
|
Reveal.initialize({
|
||||||
dependencies: [
|
dependencies: [ Markdown ]
|
||||||
{ src: '../plugin/markdown/marked.js' },
|
|
||||||
{ src: '../plugin/markdown/markdown.js' },
|
|
||||||
]
|
|
||||||
}).then( function() {
|
}).then( function() {
|
||||||
|
|
||||||
QUnit.module( 'Markdown' );
|
QUnit.module( 'Markdown' );
|
||||||
|
|||||||
@@ -24,14 +24,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="qunit-2.5.0.js"></script>
|
<script src="qunit-2.5.0.js"></script>
|
||||||
<script src="../dist/reveal.min.js"></script>
|
|
||||||
|
|
||||||
<script>
|
<script type="module">
|
||||||
|
import '../js/index.js'
|
||||||
|
import Markdown from '../plugin/markdown/markdown.js'
|
||||||
Reveal.initialize({
|
Reveal.initialize({
|
||||||
dependencies: [
|
dependencies: [ Markdown ]
|
||||||
{ src: '../plugin/markdown/marked.js' },
|
|
||||||
{ src: '../plugin/markdown/markdown.js' },
|
|
||||||
]
|
|
||||||
}).then( function() {
|
}).then( function() {
|
||||||
|
|
||||||
QUnit.module( 'Markdown' );
|
QUnit.module( 'Markdown' );
|
||||||
|
|||||||
@@ -32,15 +32,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="qunit-2.5.0.js"></script>
|
<script src="qunit-2.5.0.js"></script>
|
||||||
<script src="../dist/reveal.min.js"></script>
|
|
||||||
|
|
||||||
<script>
|
<script type="module">
|
||||||
|
import '../js/index.js'
|
||||||
|
import Markdown from '../plugin/markdown/markdown.js'
|
||||||
|
|
||||||
Reveal.initialize({
|
Reveal.initialize({
|
||||||
dependencies: [
|
dependencies: [ Markdown ],
|
||||||
{ src: '../plugin/markdown/marked.js' },
|
|
||||||
// Test loading JS files with query strings
|
|
||||||
{ src: '../plugin/markdown/markdown.js?query=string' },
|
|
||||||
],
|
|
||||||
markdown: {
|
markdown: {
|
||||||
smartypants: true
|
smartypants: true
|
||||||
}
|
}
|
||||||
@@ -49,7 +47,7 @@
|
|||||||
QUnit.module( 'Markdown' );
|
QUnit.module( 'Markdown' );
|
||||||
|
|
||||||
QUnit.test( 'Options are set', function( assert ) {
|
QUnit.test( 'Options are set', function( assert ) {
|
||||||
assert.strictEqual( marked.defaults.smartypants, true );
|
assert.strictEqual( Reveal.getPlugin( 'markdown' ).marked.defaults.smartypants, true );
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test( 'Smart quotes are activated', function( assert ) {
|
QUnit.test( 'Smart quotes are activated', function( assert ) {
|
||||||
|
|||||||
@@ -117,14 +117,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="qunit-2.5.0.js"></script>
|
<script src="qunit-2.5.0.js"></script>
|
||||||
<script src="../dist/reveal.min.js"></script>
|
|
||||||
|
|
||||||
<script>
|
<script type="module">
|
||||||
|
import '../js/index.js'
|
||||||
|
import Markdown from '../plugin/markdown/markdown.js'
|
||||||
|
|
||||||
Reveal.initialize({
|
Reveal.initialize({
|
||||||
dependencies: [
|
dependencies: [ Markdown ]
|
||||||
{ src: '../plugin/markdown/marked.js' },
|
|
||||||
{ src: '../plugin/markdown/markdown.js' },
|
|
||||||
]
|
|
||||||
}).then( function() {
|
}).then( function() {
|
||||||
|
|
||||||
QUnit.module( 'Markdown' );
|
QUnit.module( 'Markdown' );
|
||||||
|
|||||||
@@ -41,13 +41,12 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="../dist/reveal.min.js"></script>
|
<script type="module">
|
||||||
<script>
|
import '../js/index.js'
|
||||||
|
import Markdown from '../plugin/markdown/markdown.js'
|
||||||
|
|
||||||
Reveal.initialize({
|
Reveal.initialize({
|
||||||
dependencies: [
|
dependencies: [ Markdown ]
|
||||||
{ src: '../plugin/markdown/marked.js' },
|
|
||||||
{ src: '../plugin/markdown/markdown.js' },
|
|
||||||
]
|
|
||||||
}).then( function() {
|
}).then( function() {
|
||||||
|
|
||||||
QUnit.module( 'Markdown' );
|
QUnit.module( 'Markdown' );
|
||||||
|
|||||||
Reference in new issue
Block a user