move built plugin files from /dist/plugin/ to /plugin/<name>/

This commit is contained in:
Hakim El Hattab committed 2020-05-18 14:41:56 +02:00
1 parent 4e8959508b
commit fb22716ddf
27 files changed
+42 -44

No files matched your search

+5 -5
View File
@@ -413,11 +413,11 @@ Reveal.on( 'customevent', function() {
<script type="module">
import Reveal from '/dist/reveal.esm.js';
import Zoom from '/dist/plugin/zoom.esm.js';
import Notes from '/dist/plugin/notes.esm.js';
import Search from '/dist/plugin/search.esm.js';
import Markdown from '/dist/plugin/markdown.esm.js';
import Highlight from '/dist/plugin/highlight.esm.js';
import Zoom from '/plugin/zoom/zoom.esm.js';
import Notes from '/plugin/notes/notes.esm.js';
import Search from '/plugin/search/search.esm.js';
import Markdown from '/plugin/markdown/markdown.esm.js';
import Highlight from '/plugin/highlight/highlight.esm.js';
// More info https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
-5
View File
@@ -1,5 +0,0 @@
function e(t){Object.freeze(t);var a="function"==typeof t;return Object.getOwnPropertyNames(t).forEach((function(n){!t.hasOwnProperty(n)||null===t[n]||"object"!=typeof t[n]&&"function"!=typeof t[n]||a&&("caller"===n||"callee"===n||"arguments"===n)||Object.isFrozen(t[n])||e(t[n])})),t}function t(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function a(e){var t,a={},n=Array.prototype.slice.call(arguments,1);for(t in e)a[t]=e[t];return n.forEach((function(e){for(t in e)a[t]=e[t]})),a}function n(e){return e.nodeName.toLowerCase()}var i=Object.freeze({__proto__:null,escapeHTML:t,inherit:a,nodeStream:function(e){var t=[];return function e(a,i){for(var r=a.firstChild;r;r=r.nextSibling)3===r.nodeType?i+=r.nodeValue.length:1===r.nodeType&&(t.push({event:"start",offset:i,node:r}),i=e(r,i),n(r).match(/br|hr|img|input/)||t.push({event:"stop",offset:i,node:r}));return i}(e,0),t},mergeStreams:function(e,a,i){var r=0,s="",o=[];function l(){return e.length&&a.length?e[0].offset!==a[0].offset?e[0].offset<a[0].offset?e:a:"start"===a[0].event?e:a:e.length?e:a}function _(e){s+="<"+n(e)+[].map.call(e.attributes,(function(e){return" "+e.nodeName+'="'+t(e.value).replace(/"/g,"&quot;")+'"'})).join("")+">"}function c(e){s+="</"+n(e)+">"}function d(e){("start"===e.event?_:c)(e.node)}for(;e.length||a.length;){var m=l();if(s+=t(i.substring(r,m[0].offset)),r=m[0].offset,m===e){o.reverse().forEach(c);do{d(m.splice(0,1)[0]),m=l()}while(m===e&&m.length&&m[0].offset===r);o.reverse().forEach(_)}else"start"===m[0].event?o.push(m[0].node):o.pop(),d(m.splice(0,1)[0])}return s+t(i.substr(r))}});const r=e=>!!e.kind;class s{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=t(e)}openNode(e){if(!r(e))return;let t=e.kind;e.sublanguage||(t=`${this.classPrefix}${t}`),this.span(t)}closeNode(e){r(e)&&(this.buffer+="</span>")}span(e){this.buffer+=`<span class="${e}">`}value(){return this.buffer}}class o{constructor(){this.rootNode={children:[]},this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t={kind:e,children:[]};this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(e){e.children&&(e.children.every(e=>"string"==typeof e)?(e.text=e.children.join(""),delete e.children):e.children.forEach(e=>{"string"!=typeof e&&o._collapse(e)}))}}class l extends o{constructor(e){super(),this.options=e}addKeyword(e,t){""!==e&&(this.openNode(t),this.addText(e),this.closeNode())}addText(e){""!==e&&this.add(e)}addSublanguage(e,t){let a=e.root;a.kind=t,a.sublanguage=!0,this.add(a)}toHTML(){return new s(this,this.options).value()}finalize(){}}function _(e){return e&&e.source||e}const c="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",d={begin:"\\\\[\\s\\S]",relevance:0},m={className:"string",begin:"'",end:"'",illegal:"\\n",contains:[d]},u={className:"string",begin:'"',end:'"',illegal:"\\n",contains:[d]},p={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},E=function(e,t,n){var i=a({className:"comment",begin:e,end:t,contains:[]},n||{});return i.contains.push(p),i.contains.push({className:"doctag",begin:"(?:TODO|FIXME|NOTE|BUG|XXX):",relevance:0}),i},g=E("//","$"),S=E("/\\*","\\*/"),T=E("#","$"),b={className:"number",begin:"\\b\\d+(\\.\\d+)?",relevance:0},C={className:"number",begin:c,relevance:0},R={className:"number",begin:"\\b(0b[01]+)",relevance:0},N={className:"number",begin:"\\b\\d+(\\.\\d+)?(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},f={begin:/(?=\/[^\/\n]*\/)/,contains:[{className:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[d,{begin:/\[/,end:/\]/,relevance:0,contains:[d]}]}]},O={className:"title",begin:"[a-zA-Z]\\w*",relevance:0},I={className:"title",begin:"[a-zA-Z_]\\w*",relevance:0},v={begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0};var A=Object.freeze({__proto__:null,IDENT_RE:"[a-zA-Z]\\w*",UNDERSCORE_IDENT_RE:"[a-zA-Z_]\\w*",NUMBER_RE:"\\b\\d+(\\.\\d+)?",C_NUMBER_RE:c,BINARY_NUMBER_RE:"\\b(0b[01]+)",RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",BACKSLASH_ESCAPE:d,APOS_STRING_MODE:m,QUOTE_STRING_MODE:u,PHRASAL_WORDS_MODE:p,COMMENT:E,C_LINE_COMMENT_MODE:g,C_BLOCK_COMMENT_MODE:S,HASH_COMMENT_MODE:T,NUMBER_MODE:b,C_NUMBER_MODE:C,BINARY_NUMBER_MODE:R,CSS_NUMBER_MODE:N,REGEXP_MODE:f,TITLE_MODE:O,UNDERSCORE_TITLE_MODE:I,METHOD_GUARD:v}),h="of and foLine truncated
/*!
* reveal.js plugin that adds syntax highlight support.
*/
var mn={id:"highlight",HIGHLIGHT_STEP_DELIMITER:"|",HIGHLIGHT_LINE_DELIMITER:",",HIGHLIGHT_LINE_RANGE_DELIMITER:"-",init:function(e){var t=e.getConfig().highlight||{};t.highlightOnLoad="boolean"!=typeof t.highlightOnLoad||t.highlightOnLoad,t.escapeHTML="boolean"!=typeof t.escapeHTML||t.escapeHTML,[].slice.call(e.getRevealElement().querySelectorAll("pre code")).forEach((function(e){e.hasAttribute("data-trim")&&"function"==typeof e.innerHTML.trim&&(e.innerHTML=function(e){function t(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}return function(e){var a=function(e){for(var t=e.split("\n"),a=0;a<t.length&&""===t[a].trim();a++)t.splice(a--,1);for(a=t.length-1;a>=0&&""===t[a].trim();a--)t.splice(a,1);return t.join("\n")}(e.innerHTML).split("\n"),n=a.reduce((function(e,a){return a.length>0&&t(a).length>0&&e>a.length-t(a).length?a.length-t(a).length:e}),Number.POSITIVE_INFINITY);return a.map((function(e,t){return e.slice(n)})).join("\n")}(e)}(e)),t.escapeHTML&&!e.hasAttribute("data-noescape")&&(e.innerHTML=e.innerHTML.replace(/</g,"&lt;").replace(/>/g,"&gt;")),e.addEventListener("focusout",(function(e){cn.highlightBlock(e.currentTarget)}),!1),t.highlightOnLoad&&mn.highlightBlock(e)})),e.on("pdf-ready",(function(){[].slice.call(e.getRevealElement().querySelectorAll("pre code[data-line-numbers].current-fragment")).forEach((function(e){mn.scrollHighlightedLineIntoView(e,{},!0)}))}))},highlightBlock:function(e){if(cn.highlightBlock(e),0!==e.innerHTML.trim().length&&e.hasAttribute("data-line-numbers")){cn.lineNumbersBlock(e,{singleLine:!0});var t={currentBlock:e},a=mn.deserializeHighlightSteps(e.getAttribute("data-line-numbers"));if(a.length>1){var n=parseInt(e.getAttribute("data-fragment-index"),10);("number"!=typeof n||isNaN(n))&&(n=null),a.slice(1).forEach((function(a){var i=e.cloneNode(!0);i.setAttribute("data-line-numbers",mn.serializeHighlightSteps([a])),i.classList.add("fragment"),e.parentNode.appendChild(i),mn.highlightLines(i),"number"==typeof n?(i.setAttribute("data-fragment-index",n),n+=1):i.removeAttribute("data-fragment-index"),i.addEventListener("visible",mn.scrollHighlightedLineIntoView.bind(mn,i,t)),i.addEventListener("hidden",mn.scrollHighlightedLineIntoView.bind(mn,i.previousSibling,t))})),e.removeAttribute("data-fragment-index"),e.setAttribute("data-line-numbers",mn.serializeHighlightSteps([a[0]]))}var i="function"==typeof e.closest?e.closest("section:not(.stack)"):null;if(i){i.addEventListener("visible",(function a(){mn.scrollHighlightedLineIntoView(e,t,!0),i.removeEventListener("visible",a)}))}mn.highlightLines(e)}},scrollHighlightedLineIntoView:function(e,t,a){cancelAnimationFrame(t.animationFrameID),t.currentBlock&&(e.scrollTop=t.currentBlock.scrollTop),t.currentBlock=e;var n=this.getHighlightedLineBounds(e),i=e.offsetHeight,r=getComputedStyle(e);i-=parseInt(r.paddingTop)+parseInt(r.paddingBottom);var s=e.scrollTop,o=n.top+(Math.min(n.bottom-n.top,i)-i)/2,l=e.querySelector(".hljs-ln");if(l&&(o+=l.offsetTop-parseInt(r.paddingTop)),o=Math.max(Math.min(o,e.scrollHeight-i),0),!0===a||s===o)e.scrollTop=o;else{if(e.scrollHeight<=i)return;var _=0;!function a(){_=Math.min(_+.02,1),e.scrollTop=s+(o-s)*mn.easeInOutQuart(_),_<1&&(t.animationFrameID=requestAnimationFrame(a))}()}},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},getHighlightedLineBounds:function(e){var t=e.querySelectorAll(".highlight-line");if(0===t.length)return{top:0,bottom:0};var a=t[0],n=t[t.length-1];return{top:a.offsetTop,bottom:n.offsetTop+n.offsetHeight}},highlightLines:function(e,t){var a=mn.deserializeHighlightSteps(t||e.getAttribute("data-line-numbers"));a.length&&a[0].forEach((function(t){var a=[];"number"==typeof t.end?a=[].slice.call(e.querySelectorAll("table tr:nth-child(n+"+t.start+"):nth-child(-n+"+t.end+")")):"number"==typeof t.start&&(a=[].slice.call(e.querySelectorAll("table tr:nth-child("+t.start+")"))),a.length&&(a.forEach((function(e){e.classList.add("highlight-line")})),e.classList.add("has-highlights"))}))},deserializeHighlightSteps:function(e){return(e=(e=e.replace(/\s/g,"")).split(mn.HIGHLIGHT_STEP_DELIMITER)).map((function(e){return e.split(mn.HIGHLIGHT_LINE_DELIMITER).map((function(e){if(/^[\d-]+$/.test(e)){e=e.split(mn.HIGHLIGHT_LINE_RANGE_DELIMITER);var t=parseInt(e[0],10),a=parseInt(e[1],10);return isNaN(a)?{start:t}:{start:t,end:a}}return{}}))}))},serializeHighlightSteps:function(e){return e.map((function(e){return e.map((function(e){return"number"==typeof e.end?e.start+mn.HIGHLIGHT_LINE_RANGE_DELIMITER+e.end:"number"==typeof e.start?e.start:""})).join(mn.HIGHLIGHT_LINE_DELIMITER)})).join(mn.HIGHLIGHT_STEP_DELIMITER)}};export default function(){return mn}
-5
View File
@@ -1,5 +0,0 @@
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).RevealHighlight=t()}(this,(function(){"use strict";function e(t){Object.freeze(t);var a="function"==typeof t;return Object.getOwnPropertyNames(t).forEach((function(n){!t.hasOwnProperty(n)||null===t[n]||"object"!=typeof t[n]&&"function"!=typeof t[n]||a&&("caller"===n||"callee"===n||"arguments"===n)||Object.isFrozen(t[n])||e(t[n])})),t}function t(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function a(e){var t,a={},n=Array.prototype.slice.call(arguments,1);for(t in e)a[t]=e[t];return n.forEach((function(e){for(t in e)a[t]=e[t]})),a}function n(e){return e.nodeName.toLowerCase()}var i=Object.freeze({__proto__:null,escapeHTML:t,inherit:a,nodeStream:function(e){var t=[];return function e(a,i){for(var r=a.firstChild;r;r=r.nextSibling)3===r.nodeType?i+=r.nodeValue.length:1===r.nodeType&&(t.push({event:"start",offset:i,node:r}),i=e(r,i),n(r).match(/br|hr|img|input/)||t.push({event:"stop",offset:i,node:r}));return i}(e,0),t},mergeStreams:function(e,a,i){var r=0,s="",o=[];function l(){return e.length&&a.length?e[0].offset!==a[0].offset?e[0].offset<a[0].offset?e:a:"start"===a[0].event?e:a:e.length?e:a}function _(e){s+="<"+n(e)+[].map.call(e.attributes,(function(e){return" "+e.nodeName+'="'+t(e.value).replace(/"/g,"&quot;")+'"'})).join("")+">"}function c(e){s+="</"+n(e)+">"}function d(e){("start"===e.event?_:c)(e.node)}for(;e.length||a.length;){var m=l();if(s+=t(i.substring(r,m[0].offset)),r=m[0].offset,m===e){o.reverse().forEach(c);do{d(m.splice(0,1)[0]),m=l()}while(m===e&&m.length&&m[0].offset===r);o.reverse().forEach(_)}else"start"===m[0].event?o.push(m[0].node):o.pop(),d(m.splice(0,1)[0])}return s+t(i.substr(r))}});const r=e=>!!e.kind;class s{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=t(e)}openNode(e){if(!r(e))return;let t=e.kind;e.sublanguage||(t=`${this.classPrefix}${t}`),this.span(t)}closeNode(e){r(e)&&(this.buffer+="</span>")}span(e){this.buffer+=`<span class="${e}">`}value(){return this.buffer}}class o{constructor(){this.rootNode={children:[]},this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t={kind:e,children:[]};this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(e){e.children&&(e.children.every(e=>"string"==typeof e)?(e.text=e.children.join(""),delete e.children):e.children.forEach(e=>{"string"!=typeof e&&o._collapse(e)}))}}class l extends o{constructor(e){super(),this.options=e}addKeyword(e,t){""!==e&&(this.openNode(t),this.addText(e),this.closeNode())}addText(e){""!==e&&this.add(e)}addSublanguage(e,t){let a=e.root;a.kind=t,a.sublanguage=!0,this.add(a)}toHTML(){return new s(this,this.options).value()}finalize(){}}function _(e){return e&&e.source||e}const c="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",d={begin:"\\\\[\\s\\S]",relevance:0},m={className:"string",begin:"'",end:"'",illegal:"\\n",contains:[d]},u={className:"string",begin:'"',end:'"',illegal:"\\n",contains:[d]},p={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},E=function(e,t,n){var i=a({className:"comment",begin:e,end:t,contains:[]},n||{});return i.contains.push(p),i.contains.push({className:"doctag",begin:"(?:TODO|FIXME|NOTE|BUG|XXX):",relevance:0}),i},g=E("//","$"),S=E("/\\*","\\*/"),T=E("#","$"),b={className:"number",begin:"\\b\\d+(\\.\\d+)?",relevance:0},C={className:"number",begin:c,relevance:0},R={className:"number",begin:"\\b(0b[01]+)",relevance:0},N={className:"number",begin:"\\b\\d+(\\.\\d+)?(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},f={begin:/(?=\/[^\/\n]*\/)/,contains:[{className:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[d,{begin:/\[/,end:/\]/,relevance:0,contains:[d]}]}]},O={className:"title",begin:"[a-zA-Z]\\w*",relevance:0},I={className:"title",begin:"[a-zA-Z_]\\w*",relevance:0},v={begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0};var A=Object.freeze({__proto__:null,IDENT_RE:"[a-zA-Z]\\w*",UNDERSCORE_IDENT_RE:"[a-zA-Z_]\\w*",NUMBER_RE:"\\b\\d+(\\.\\d+)?",C_NUMBER_RE:c,BINARY_NUMBER_RE:"\\b(0b[01]+)",RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",BACKSLASH_ESCAPE:d,APOS_STRING_MODE:m,QUOTE_STRING_MODE:u,PHRASAL_WORDS_MODE:p,COMMENT:E,C_LINE_COMMENT_MLine truncated
/*!
* reveal.js plugin that adds syntax highlight support.
*/
var mn={id:"highlight",HIGHLIGHT_STEP_DELIMITER:"|",HIGHLIGHT_LINE_DELIMITER:",",HIGHLIGHT_LINE_RANGE_DELIMITER:"-",init:function(e){var t=e.getConfig().highlight||{};t.highlightOnLoad="boolean"!=typeof t.highlightOnLoad||t.highlightOnLoad,t.escapeHTML="boolean"!=typeof t.escapeHTML||t.escapeHTML,[].slice.call(e.getRevealElement().querySelectorAll("pre code")).forEach((function(e){e.hasAttribute("data-trim")&&"function"==typeof e.innerHTML.trim&&(e.innerHTML=function(e){function t(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}return function(e){var a=function(e){for(var t=e.split("\n"),a=0;a<t.length&&""===t[a].trim();a++)t.splice(a--,1);for(a=t.length-1;a>=0&&""===t[a].trim();a--)t.splice(a,1);return t.join("\n")}(e.innerHTML).split("\n"),n=a.reduce((function(e,a){return a.length>0&&t(a).length>0&&e>a.length-t(a).length?a.length-t(a).length:e}),Number.POSITIVE_INFINITY);return a.map((function(e,t){return e.slice(n)})).join("\n")}(e)}(e)),t.escapeHTML&&!e.hasAttribute("data-noescape")&&(e.innerHTML=e.innerHTML.replace(/</g,"&lt;").replace(/>/g,"&gt;")),e.addEventListener("focusout",(function(e){cn.highlightBlock(e.currentTarget)}),!1),t.highlightOnLoad&&mn.highlightBlock(e)})),e.on("pdf-ready",(function(){[].slice.call(e.getRevealElement().querySelectorAll("pre code[data-line-numbers].current-fragment")).forEach((function(e){mn.scrollHighlightedLineIntoView(e,{},!0)}))}))},highlightBlock:function(e){if(cn.highlightBlock(e),0!==e.innerHTML.trim().length&&e.hasAttribute("data-line-numbers")){cn.lineNumbersBlock(e,{singleLine:!0});var t={currentBlock:e},a=mn.deserializeHighlightSteps(e.getAttribute("data-line-numbers"));if(a.length>1){var n=parseInt(e.getAttribute("data-fragment-index"),10);("number"!=typeof n||isNaN(n))&&(n=null),a.slice(1).forEach((function(a){var i=e.cloneNode(!0);i.setAttribute("data-line-numbers",mn.serializeHighlightSteps([a])),i.classList.add("fragment"),e.parentNode.appendChild(i),mn.highlightLines(i),"number"==typeof n?(i.setAttribute("data-fragment-index",n),n+=1):i.removeAttribute("data-fragment-index"),i.addEventListener("visible",mn.scrollHighlightedLineIntoView.bind(mn,i,t)),i.addEventListener("hidden",mn.scrollHighlightedLineIntoView.bind(mn,i.previousSibling,t))})),e.removeAttribute("data-fragment-index"),e.setAttribute("data-line-numbers",mn.serializeHighlightSteps([a[0]]))}var i="function"==typeof e.closest?e.closest("section:not(.stack)"):null;if(i){i.addEventListener("visible",(function a(){mn.scrollHighlightedLineIntoView(e,t,!0),i.removeEventListener("visible",a)}))}mn.highlightLines(e)}},scrollHighlightedLineIntoView:function(e,t,a){cancelAnimationFrame(t.animationFrameID),t.currentBlock&&(e.scrollTop=t.currentBlock.scrollTop),t.currentBlock=e;var n=this.getHighlightedLineBounds(e),i=e.offsetHeight,r=getComputedStyle(e);i-=parseInt(r.paddingTop)+parseInt(r.paddingBottom);var s=e.scrollTop,o=n.top+(Math.min(n.bottom-n.top,i)-i)/2,l=e.querySelector(".hljs-ln");if(l&&(o+=l.offsetTop-parseInt(r.paddingTop)),o=Math.max(Math.min(o,e.scrollHeight-i),0),!0===a||s===o)e.scrollTop=o;else{if(e.scrollHeight<=i)return;var _=0;!function a(){_=Math.min(_+.02,1),e.scrollTop=s+(o-s)*mn.easeInOutQuart(_),_<1&&(t.animationFrameID=requestAnimationFrame(a))}()}},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},getHighlightedLineBounds:function(e){var t=e.querySelectorAll(".highlight-line");if(0===t.length)return{top:0,bottom:0};var a=t[0],n=t[t.length-1];return{top:a.offsetTop,bottom:n.offsetTop+n.offsetHeight}},highlightLines:function(e,t){var a=mn.deserializeHighlightSteps(t||e.getAttribute("data-line-numbers"));a.length&&a[0].forEach((function(t){var a=[];"number"==typeof t.end?a=[].slice.call(e.querySelectorAll("table tr:nth-child(n+"+t.start+"):nth-child(-n+"+t.end+")")):"number"==typeof t.start&&(a=[].slice.call(e.querySelectorAll("table tr:nth-child("+t.start+")"))),a.length&&(a.forEach((function(e){e.classList.add("highlight-line")})),e.classList.add("has-highlights"))}))},deserializeHighlightSteps:function(e){return(e=(e=e.replace(/\s/g,"")).split(mn.HIGHLIGHT_STEP_DELIMITER)).map((function(e){return e.split(mn.HIGHLIGHT_LINE_DELIMITER).map((function(e){if(/^[\d-]+$/.test(e)){e=e.split(mn.HIGHLIGHT_LINE_RANGE_DELIMITER);var t=parseInt(e[0],10),a=parseInt(e[1],10);return isNaN(a)?{start:t}:{start:t,end:a}}return{}}))}))},serializeHighlightSteps:function(e){return e.map((function(e){return e.map((function(e){return"number"==typeof e.end?e.start+mn.HIGHLIGHT_LINE_RANGE_DELIMITER+e.end:"number"==typeof e.start?e.start:""})).join(mn.HIGHLIGHT_LINE_DELIMITER)})).join(mn.HIGHLIGHT_STEP_DELIMITER)}};return function(){return mn}}));
+1 -1
View File
@@ -163,7 +163,7 @@
</div>
<script src="../dist/reveal.js"></script>
<script src="../dist/plugin/highlight.js"></script>
<script src="../plugin/highlight/highlight.js"></script>
<script>
Reveal.initialize({
center: true,
+1 -1
View File
@@ -79,7 +79,7 @@
</div>
<script src="../dist/reveal.js"></script>
<script src="../dist/plugin/highlight.js"></script>
<script src="../plugin/highlight/highlight.js"></script>
<script>
Reveal.initialize({
center: true,
+3 -3
View File
@@ -110,9 +110,9 @@
</div>
<script src="../dist/reveal.js"></script>
<script src="../dist/plugin/markdown.js"></script>
<script src="../dist/plugin/highlight.js"></script>
<script src="../dist/plugin/notes.js"></script>
<script src="../plugin/markdown/markdown.js"></script>
<script src="../plugin/highlight/highlight.js"></script>
<script src="../plugin/notes/notes.js"></script>
<script>
+1 -1
View File
@@ -193,7 +193,7 @@
},
dependencies: [
{ src: '../dist/plugin/math.js', async: true }
{ src: '../plugin/math/math.js', async: true }
]
});
</script>
+3 -3
View File
@@ -67,9 +67,9 @@
</style>
<script src="../dist/reveal.js"></script>
<script src="../dist/plugin/highlight.js"></script>
<script src="../dist/plugin/markdown.js"></script>
<script src="../dist/plugin/math.js"></script>
<script src="../plugin/highlight/highlight.js"></script>
<script src="../plugin/markdown/markdown.js"></script>
<script src="../plugin/math/math.js"></script>
<script>
let deck1 = new Reveal( document.querySelector( '.deck1' ), {
+7 -7
View File
@@ -108,12 +108,12 @@ gulp.task('js', gulp.parallel('js-es5', 'js-es6'));
// built-in plugins
gulp.task('plugins', () => {
return Promise.all([
{ name: 'RevealHighlight', input: './plugin/highlight/plugin.js', output: './dist/plugin/highlight' },
{ name: 'RevealMarkdown', input: './plugin/markdown/plugin.js', output: './dist/plugin/markdown' },
{ name: 'RevealSearch', input: './plugin/search/plugin.js', output: './dist/plugin/search' },
{ name: 'RevealNotes', input: './plugin/notes/plugin.js', output: './dist/plugin/notes' },
{ name: 'RevealZoom', input: './plugin/zoom/plugin.js', output: './dist/plugin/zoom' },
{ name: 'RevealMath', input: './plugin/math/plugin.js', output: './dist/plugin/math' },
{ name: 'RevealHighlight', input: './plugin/highlight/plugin.js', output: './plugin/highlight/highlight' },
{ name: 'RevealMarkdown', input: './plugin/markdown/plugin.js', output: './plugin/markdown/markdown' },
{ name: 'RevealSearch', input: './plugin/search/plugin.js', output: './plugin/search/search' },
{ name: 'RevealNotes', input: './plugin/notes/plugin.js', output: './plugin/notes/notes' },
{ name: 'RevealZoom', input: './plugin/zoom/plugin.js', output: './plugin/zoom/zoom' },
{ name: 'RevealMath', input: './plugin/math/plugin.js', output: './plugin/math/math' },
].map( plugin => {
return rollup({
input: plugin.input,
@@ -248,7 +248,7 @@ gulp.task('serve', () => {
gulp.watch(['js/**'], gulp.series('js', 'test'))
gulp.watch(['plugin/**/*.js'], gulp.series('plugins'))
gulp.watch(['plugin/**/plugin.js'], gulp.series('plugins'))
gulp.watch(['test/*.html'], gulp.series('test'))
+3 -3
View File
@@ -22,9 +22,9 @@
</div>
<script src="dist/reveal.js"></script>
<script src="dist/plugin/markdown.js"></script>
<script src="dist/plugin/highlight.js"></script>
<script src="dist/plugin/notes.js"></script>
<script src="plugin/markdown/markdown.js"></script>
<script src="plugin/highlight/highlight.js"></script>
<script src="plugin/notes/notes.js"></script>
<script>
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
@@ -1,5 +0,0 @@
import hljs from 'highlight.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 */
!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;hljs?(hljs.initLineNumbersOnLoad=r,hljs.lineNumbersBlock=l,hljs.lineNumbersValue=o,t()):n.console.error("highlight.js not detected!")}(window,document);
+5
View File
@@ -0,0 +1,5 @@
function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e){Object.freeze(e);var a="function"==typeof e;return Object.getOwnPropertyNames(e).forEach((function(n){!e.hasOwnProperty(n)||null===e[n]||"object"!=typeof e[n]&&"function"!=typeof e[n]||a&&("caller"===n||"callee"===n||"arguments"===n)||Object.isFrozen(e[n])||t(e[n])})),e}function a(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function n(e){var t,a={},n=Array.prototype.slice.call(arguments,1);for(t in e)a[t]=e[t];return n.forEach((function(e){for(t in e)a[t]=e[t]})),a}function i(e){return e.nodeName.toLowerCase()}var r=Object.freeze({__proto__:null,escapeHTML:a,inherit:n,nodeStream:function(e){var t=[];return function e(a,n){for(var r=a.firstChild;r;r=r.nextSibling)3===r.nodeType?n+=r.nodeValue.length:1===r.nodeType&&(t.push({event:"start",offset:n,node:r}),n=e(r,n),i(r).match(/br|hr|img|input/)||t.push({event:"stop",offset:n,node:r}));return n}(e,0),t},mergeStreams:function(e,t,n){var r=0,s="",o=[];function l(){return e.length&&t.length?e[0].offset!==t[0].offset?e[0].offset<t[0].offset?e:t:"start"===t[0].event?e:t:e.length?e:t}function _(e){s+="<"+i(e)+[].map.call(e.attributes,(function(e){return" "+e.nodeName+'="'+a(e.value).replace(/"/g,"&quot;")+'"'})).join("")+">"}function c(e){s+="</"+i(e)+">"}function d(e){("start"===e.event?_:c)(e.node)}for(;e.length||t.length;){var m=l();if(s+=a(n.substring(r,m[0].offset)),r=m[0].offset,m===e){o.reverse().forEach(c);do{d(m.splice(0,1)[0]),m=l()}while(m===e&&m.length&&m[0].offset===r);o.reverse().forEach(_)}else"start"===m[0].event?o.push(m[0].node):o.pop(),d(m.splice(0,1)[0])}return s+a(n.substr(r))}});const s=e=>!!e.kind;class o{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=a(e)}openNode(e){if(!s(e))return;let t=e.kind;e.sublanguage||(t=`${this.classPrefix}${t}`),this.span(t)}closeNode(e){s(e)&&(this.buffer+="</span>")}span(e){this.buffer+=`<span class="${e}">`}value(){return this.buffer}}class l{constructor(){this.rootNode={children:[]},this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t={kind:e,children:[]};this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(e){e.children&&(e.children.every(e=>"string"==typeof e)?(e.text=e.children.join(""),delete e.children):e.children.forEach(e=>{"string"!=typeof e&&l._collapse(e)}))}}class _ extends l{constructor(e){super(),this.options=e}addKeyword(e,t){""!==e&&(this.openNode(t),this.addText(e),this.closeNode())}addText(e){""!==e&&this.add(e)}addSublanguage(e,t){let a=e.root;a.kind=t,a.sublanguage=!0,this.add(a)}toHTML(){return new o(this,this.options).value()}finalize(){}}function c(e){return e&&e.source||e}const d="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",m={begin:"\\\\[\\s\\S]",relevance:0},u={className:"string",begin:"'",end:"'",illegal:"\\n",contains:[m]},p={className:"string",begin:'"',end:'"',illegal:"\\n",contains:[m]},E={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},g=function(e,t,a){var i=n({className:"comment",begin:e,end:t,contains:[]},a||{});return i.contains.push(E),i.contains.push({className:"doctag",begin:"(?:TODO|FIXME|NOTE|BUG|XXX):",relevance:0}),i},S=g("//","$"),T=g("/\\*","\\*/"),b=g("#","$"),C={className:"number",begin:"\\b\\d+(\\.\\d+)?",relevance:0},R={className:"number",begin:d,relevance:0},N={className:"number",begin:"\\b(0b[01]+)",relevance:0},f={className:"number",begin:"\\b\\d+(\\.\\d+)?(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},O={begin:/(?=\/[^\/\n]*\/)/,contains:[{className:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[m,{begin:/\[/,end:/\]/,relevance:0,contains:[m]}]}]},I={className:"title",begin:"[a-zA-Z]\\w*",relevance:0},v={className:"title",begin:"[a-zA-Z_]\\w*",relevance:0},A={begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0};var h=Object.freeze({__proto__:null,IDENT_RE:"[a-zA-Z]\\w*",UNDERSCORE_IDENT_RE:"[a-zA-Z_]\\w*",NUMBER_RE:"\\b\\d+(\\.\\d+)?",C_NUMBER_RE:d,BINARY_NUMBER_RE:"\\b(0b[01]+)",RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",BACKSLASH_ESCAPE:m,APOS_STRING_MODE:u,QUOTE_STRING_MODE:p,PHRASAL_WORDS_MOLine truncated
/*!
* reveal.js plugin that adds syntax highlight support.
*/
var mn={id:"highlight",HIGHLIGHT_STEP_DELIMITER:"|",HIGHLIGHT_LINE_DELIMITER:",",HIGHLIGHT_LINE_RANGE_DELIMITER:"-",init:function(e){var t=e.getConfig().highlight||{};t.highlightOnLoad="boolean"!=typeof t.highlightOnLoad||t.highlightOnLoad,t.escapeHTML="boolean"!=typeof t.escapeHTML||t.escapeHTML,[].slice.call(e.getRevealElement().querySelectorAll("pre code")).forEach((function(e){e.hasAttribute("data-trim")&&"function"==typeof e.innerHTML.trim&&(e.innerHTML=function(e){function t(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}return function(e){var a=function(e){for(var t=e.split("\n"),a=0;a<t.length&&""===t[a].trim();a++)t.splice(a--,1);for(a=t.length-1;a>=0&&""===t[a].trim();a--)t.splice(a,1);return t.join("\n")}(e.innerHTML).split("\n"),n=a.reduce((function(e,a){return a.length>0&&t(a).length>0&&e>a.length-t(a).length?a.length-t(a).length:e}),Number.POSITIVE_INFINITY);return a.map((function(e,t){return e.slice(n)})).join("\n")}(e)}(e)),t.escapeHTML&&!e.hasAttribute("data-noescape")&&(e.innerHTML=e.innerHTML.replace(/</g,"&lt;").replace(/>/g,"&gt;")),e.addEventListener("focusout",(function(e){dn.highlightBlock(e.currentTarget)}),!1),t.highlightOnLoad&&mn.highlightBlock(e)})),e.on("pdf-ready",(function(){[].slice.call(e.getRevealElement().querySelectorAll("pre code[data-line-numbers].current-fragment")).forEach((function(e){mn.scrollHighlightedLineIntoView(e,{},!0)}))}))},highlightBlock:function(e){if(dn.highlightBlock(e),0!==e.innerHTML.trim().length&&e.hasAttribute("data-line-numbers")){dn.lineNumbersBlock(e,{singleLine:!0});var t={currentBlock:e},a=mn.deserializeHighlightSteps(e.getAttribute("data-line-numbers"));if(a.length>1){var n=parseInt(e.getAttribute("data-fragment-index"),10);("number"!=typeof n||isNaN(n))&&(n=null),a.slice(1).forEach((function(a){var i=e.cloneNode(!0);i.setAttribute("data-line-numbers",mn.serializeHighlightSteps([a])),i.classList.add("fragment"),e.parentNode.appendChild(i),mn.highlightLines(i),"number"==typeof n?(i.setAttribute("data-fragment-index",n),n+=1):i.removeAttribute("data-fragment-index"),i.addEventListener("visible",mn.scrollHighlightedLineIntoView.bind(mn,i,t)),i.addEventListener("hidden",mn.scrollHighlightedLineIntoView.bind(mn,i.previousSibling,t))})),e.removeAttribute("data-fragment-index"),e.setAttribute("data-line-numbers",mn.serializeHighlightSteps([a[0]]))}var i="function"==typeof e.closest?e.closest("section:not(.stack)"):null;if(i){i.addEventListener("visible",(function a(){mn.scrollHighlightedLineIntoView(e,t,!0),i.removeEventListener("visible",a)}))}mn.highlightLines(e)}},scrollHighlightedLineIntoView:function(e,t,a){cancelAnimationFrame(t.animationFrameID),t.currentBlock&&(e.scrollTop=t.currentBlock.scrollTop),t.currentBlock=e;var n=this.getHighlightedLineBounds(e),i=e.offsetHeight,r=getComputedStyle(e);i-=parseInt(r.paddingTop)+parseInt(r.paddingBottom);var s=e.scrollTop,o=n.top+(Math.min(n.bottom-n.top,i)-i)/2,l=e.querySelector(".hljs-ln");if(l&&(o+=l.offsetTop-parseInt(r.paddingTop)),o=Math.max(Math.min(o,e.scrollHeight-i),0),!0===a||s===o)e.scrollTop=o;else{if(e.scrollHeight<=i)return;var _=0;!function a(){_=Math.min(_+.02,1),e.scrollTop=s+(o-s)*mn.easeInOutQuart(_),_<1&&(t.animationFrameID=requestAnimationFrame(a))}()}},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},getHighlightedLineBounds:function(e){var t=e.querySelectorAll(".highlight-line");if(0===t.length)return{top:0,bottom:0};var a=t[0],n=t[t.length-1];return{top:a.offsetTop,bottom:n.offsetTop+n.offsetHeight}},highlightLines:function(e,t){var a=mn.deserializeHighlightSteps(t||e.getAttribute("data-line-numbers"));a.length&&a[0].forEach((function(t){var a=[];"number"==typeof t.end?a=[].slice.call(e.querySelectorAll("table tr:nth-child(n+"+t.start+"):nth-child(-n+"+t.end+")")):"number"==typeof t.start&&(a=[].slice.call(e.querySelectorAll("table tr:nth-child("+t.start+")"))),a.length&&(a.forEach((function(e){e.classList.add("highlight-line")})),e.classList.add("has-highlights"))}))},deserializeHighlightSteps:function(e){return(e=(e=e.replace(/\s/g,"")).split(mn.HIGHLIGHT_STEP_DELIMITER)).map((function(e){return e.split(mn.HIGHLIGHT_LINE_DELIMITER).map((function(e){if(/^[\d-]+$/.test(e)){e=e.split(mn.HIGHLIGHT_LINE_RANGE_DELIMITER);var t=parseInt(e[0],10),a=parseInt(e[1],10);return isNaN(a)?{start:t}:{start:t,end:a}}return{}}))}))},serializeHighlightSteps:function(e){return e.map((function(e){return e.map((function(e){return"number"==typeof e.end?e.start+mn.HIGHLIGHT_LINE_RANGE_DELIMITER+e.end:"number"==typeof e.start?e.start:""})).join(mn.HIGHLIGHT_LINE_DELIMITER)})).join(mn.HIGHLIGHT_STEP_DELIMITER)}};export default function(){return mn}
+5
View File
@@ -0,0 +1,5 @@
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).RevealHighlight=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e){Object.freeze(e);var a="function"==typeof e;return Object.getOwnPropertyNames(e).forEach((function(n){!e.hasOwnProperty(n)||null===e[n]||"object"!=typeof e[n]&&"function"!=typeof e[n]||a&&("caller"===n||"callee"===n||"arguments"===n)||Object.isFrozen(e[n])||t(e[n])})),e}function a(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function n(e){var t,a={},n=Array.prototype.slice.call(arguments,1);for(t in e)a[t]=e[t];return n.forEach((function(e){for(t in e)a[t]=e[t]})),a}function i(e){return e.nodeName.toLowerCase()}var r=Object.freeze({__proto__:null,escapeHTML:a,inherit:n,nodeStream:function(e){var t=[];return function e(a,n){for(var r=a.firstChild;r;r=r.nextSibling)3===r.nodeType?n+=r.nodeValue.length:1===r.nodeType&&(t.push({event:"start",offset:n,node:r}),n=e(r,n),i(r).match(/br|hr|img|input/)||t.push({event:"stop",offset:n,node:r}));return n}(e,0),t},mergeStreams:function(e,t,n){var r=0,s="",o=[];function l(){return e.length&&t.length?e[0].offset!==t[0].offset?e[0].offset<t[0].offset?e:t:"start"===t[0].event?e:t:e.length?e:t}function _(e){s+="<"+i(e)+[].map.call(e.attributes,(function(e){return" "+e.nodeName+'="'+a(e.value).replace(/"/g,"&quot;")+'"'})).join("")+">"}function c(e){s+="</"+i(e)+">"}function d(e){("start"===e.event?_:c)(e.node)}for(;e.length||t.length;){var m=l();if(s+=a(n.substring(r,m[0].offset)),r=m[0].offset,m===e){o.reverse().forEach(c);do{d(m.splice(0,1)[0]),m=l()}while(m===e&&m.length&&m[0].offset===r);o.reverse().forEach(_)}else"start"===m[0].event?o.push(m[0].node):o.pop(),d(m.splice(0,1)[0])}return s+a(n.substr(r))}});const s=e=>!!e.kind;class o{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=a(e)}openNode(e){if(!s(e))return;let t=e.kind;e.sublanguage||(t=`${this.classPrefix}${t}`),this.span(t)}closeNode(e){s(e)&&(this.buffer+="</span>")}span(e){this.buffer+=`<span class="${e}">`}value(){return this.buffer}}class l{constructor(){this.rootNode={children:[]},this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t={kind:e,children:[]};this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(e){e.children&&(e.children.every(e=>"string"==typeof e)?(e.text=e.children.join(""),delete e.children):e.children.forEach(e=>{"string"!=typeof e&&l._collapse(e)}))}}class _ extends l{constructor(e){super(),this.options=e}addKeyword(e,t){""!==e&&(this.openNode(t),this.addText(e),this.closeNode())}addText(e){""!==e&&this.add(e)}addSublanguage(e,t){let a=e.root;a.kind=t,a.sublanguage=!0,this.add(a)}toHTML(){return new o(this,this.options).value()}finalize(){}}function c(e){return e&&e.source||e}const d="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",m={begin:"\\\\[\\s\\S]",relevance:0},u={className:"string",begin:"'",end:"'",illegal:"\\n",contains:[m]},p={className:"string",begin:'"',end:'"',illegal:"\\n",contains:[m]},E={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},g=function(e,t,a){var i=n({className:"comment",begin:e,end:t,contains:[]},a||{});return i.contains.push(E),i.contains.push({className:"doctag",begin:"(?:TODO|FIXME|NOTE|BUG|XXX):",relevance:0}),i},S=g("//","$"),T=g("/\\*","\\*/"),b=g("#","$"),C={className:"number",begin:"\\b\\d+(\\.\\d+)?",relevance:0},R={className:"number",begin:d,relevance:0},N={className:"number",begin:"\\b(0b[01]+)",relevance:0},f={className:"number",begin:"\\b\\d+(\\.\\d+)?(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},O={begin:/(?=\/[^\/\n]*\/)/,contains:[{className:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[m,{begin:/\[/,end:/\]/,relevance:0,contains:[m]}]}]},I={className:"title",begin:"[a-zA-Z]\\w*",relevance:0},v={className:"title",begin:"[a-zA-Z_]\\w*",relevance:0},A={begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0};var h=Object.freeze({__proto__:null,IDENT_RE:"[a-zA-Z]\\w*",UNDERSCORE_IDENT_RE:"[a-zA-Z_]\\w*",NUMBER_RE:"\\b\\d+(\\.\\d+)?",C_NUMBER_RE:d,BINARY_NUMBER_RE:"\\b(0b[01]+)",RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&Line truncated
/*!
* reveal.js plugin that adds syntax highlight support.
*/
var mn={id:"highlight",HIGHLIGHT_STEP_DELIMITER:"|",HIGHLIGHT_LINE_DELIMITER:",",HIGHLIGHT_LINE_RANGE_DELIMITER:"-",init:function(e){var t=e.getConfig().highlight||{};t.highlightOnLoad="boolean"!=typeof t.highlightOnLoad||t.highlightOnLoad,t.escapeHTML="boolean"!=typeof t.escapeHTML||t.escapeHTML,[].slice.call(e.getRevealElement().querySelectorAll("pre code")).forEach((function(e){e.hasAttribute("data-trim")&&"function"==typeof e.innerHTML.trim&&(e.innerHTML=function(e){function t(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}return function(e){var a=function(e){for(var t=e.split("\n"),a=0;a<t.length&&""===t[a].trim();a++)t.splice(a--,1);for(a=t.length-1;a>=0&&""===t[a].trim();a--)t.splice(a,1);return t.join("\n")}(e.innerHTML).split("\n"),n=a.reduce((function(e,a){return a.length>0&&t(a).length>0&&e>a.length-t(a).length?a.length-t(a).length:e}),Number.POSITIVE_INFINITY);return a.map((function(e,t){return e.slice(n)})).join("\n")}(e)}(e)),t.escapeHTML&&!e.hasAttribute("data-noescape")&&(e.innerHTML=e.innerHTML.replace(/</g,"&lt;").replace(/>/g,"&gt;")),e.addEventListener("focusout",(function(e){dn.highlightBlock(e.currentTarget)}),!1),t.highlightOnLoad&&mn.highlightBlock(e)})),e.on("pdf-ready",(function(){[].slice.call(e.getRevealElement().querySelectorAll("pre code[data-line-numbers].current-fragment")).forEach((function(e){mn.scrollHighlightedLineIntoView(e,{},!0)}))}))},highlightBlock:function(e){if(dn.highlightBlock(e),0!==e.innerHTML.trim().length&&e.hasAttribute("data-line-numbers")){dn.lineNumbersBlock(e,{singleLine:!0});var t={currentBlock:e},a=mn.deserializeHighlightSteps(e.getAttribute("data-line-numbers"));if(a.length>1){var n=parseInt(e.getAttribute("data-fragment-index"),10);("number"!=typeof n||isNaN(n))&&(n=null),a.slice(1).forEach((function(a){var i=e.cloneNode(!0);i.setAttribute("data-line-numbers",mn.serializeHighlightSteps([a])),i.classList.add("fragment"),e.parentNode.appendChild(i),mn.highlightLines(i),"number"==typeof n?(i.setAttribute("data-fragment-index",n),n+=1):i.removeAttribute("data-fragment-index"),i.addEventListener("visible",mn.scrollHighlightedLineIntoView.bind(mn,i,t)),i.addEventListener("hidden",mn.scrollHighlightedLineIntoView.bind(mn,i.previousSibling,t))})),e.removeAttribute("data-fragment-index"),e.setAttribute("data-line-numbers",mn.serializeHighlightSteps([a[0]]))}var i="function"==typeof e.closest?e.closest("section:not(.stack)"):null;if(i){i.addEventListener("visible",(function a(){mn.scrollHighlightedLineIntoView(e,t,!0),i.removeEventListener("visible",a)}))}mn.highlightLines(e)}},scrollHighlightedLineIntoView:function(e,t,a){cancelAnimationFrame(t.animationFrameID),t.currentBlock&&(e.scrollTop=t.currentBlock.scrollTop),t.currentBlock=e;var n=this.getHighlightedLineBounds(e),i=e.offsetHeight,r=getComputedStyle(e);i-=parseInt(r.paddingTop)+parseInt(r.paddingBottom);var s=e.scrollTop,o=n.top+(Math.min(n.bottom-n.top,i)-i)/2,l=e.querySelector(".hljs-ln");if(l&&(o+=l.offsetTop-parseInt(r.paddingTop)),o=Math.max(Math.min(o,e.scrollHeight-i),0),!0===a||s===o)e.scrollTop=o;else{if(e.scrollHeight<=i)return;var _=0;!function a(){_=Math.min(_+.02,1),e.scrollTop=s+(o-s)*mn.easeInOutQuart(_),_<1&&(t.animationFrameID=requestAnimationFrame(a))}()}},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},getHighlightedLineBounds:function(e){var t=e.querySelectorAll(".highlight-line");if(0===t.length)return{top:0,bottom:0};var a=t[0],n=t[t.length-1];return{top:a.offsetTop,bottom:n.offsetTop+n.offsetHeight}},highlightLines:function(e,t){var a=mn.deserializeHighlightSteps(t||e.getAttribute("data-line-numbers"));a.length&&a[0].forEach((function(t){var a=[];"number"==typeof t.end?a=[].slice.call(e.querySelectorAll("table tr:nth-child(n+"+t.start+"):nth-child(-n+"+t.end+")")):"number"==typeof t.start&&(a=[].slice.call(e.querySelectorAll("table tr:nth-child("+t.start+")"))),a.length&&(a.forEach((function(e){e.classList.add("highlight-line")})),e.classList.add("has-highlights"))}))},deserializeHighlightSteps:function(e){return(e=(e=e.replace(/\s/g,"")).split(mn.HIGHLIGHT_STEP_DELIMITER)).map((function(e){return e.split(mn.HIGHLIGHT_LINE_DELIMITER).map((function(e){if(/^[\d-]+$/.test(e)){e=e.split(mn.HIGHLIGHT_LINE_RANGE_DELIMITER);var t=parseInt(e[0],10),a=parseInt(e[1],10);return isNaN(a)?{start:t}:{start:t,end:a}}return{}}))}))},serializeHighlightSteps:function(e){return e.map((function(e){return e.map((function(e){return"number"==typeof e.end?e.start+mn.HIGHLIGHT_LINE_RANGE_DELIMITER+e.end:"number"==typeof e.start?e.start:""})).join(mn.HIGHLIGHT_LINE_DELIMITER)})).join(mn.HIGHLIGHT_STEP_DELIMITER)}};return function(){return mn}}));
+4 -1
View File
@@ -1,5 +1,8 @@
import hljs from 'highlight.js'
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 */
!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;hljs?(hljs.initLineNumbersOnLoad=r,hljs.lineNumbersBlock=l,hljs.lineNumbersValue=o,t()):n.console.error("highlight.js not detected!")}(window,document);
/*!
* reveal.js plugin that adds syntax highlight support.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2 -2
View File
@@ -286,8 +286,8 @@
<script type="module">
import Reveal from '../dist/reveal.esm.js'
import Markdown from '../dist/plugin/markdown.esm.js'
import Highlight from '../dist/plugin/highlight.esm.js'
import Markdown from '../plugin/markdown/markdown.esm.js'
import Highlight from '../plugin/highlight/highlight.esm.js'
let deck1 = new Reveal( document.querySelector( '.deck1' ), { plugins: [ Markdown ] })
deck1.addEventListener( 'ready', function() {
+1 -1
View File
@@ -37,7 +37,7 @@
</div>
<script src="../dist/reveal.js"></script>
<script src="../dist/plugin/zoom.js"></script>
<script src="../plugin/zoom/zoom.js"></script>
<script>
QUnit.module( 'Multiple reveal.js instances' );
+1 -1
View File
@@ -39,7 +39,7 @@
<script type="module">
import Reveal from '../dist/reveal.esm.js';
import Zoom from '../dist/plugin/zoom.esm.js';
import Zoom from '../plugin/zoom/zoom.esm.js';
QUnit.module( 'Multiple reveal.js instances' );