Skip to content

Instantly share code, notes, and snippets.

@dezGusty
Last active November 15, 2018 10:06
Show Gist options
  • Save dezGusty/d80851ecab617cd86ff67d260b2bc132 to your computer and use it in GitHub Desktop.
Save dezGusty/d80851ecab617cd86ff67d260b2bc132 to your computer and use it in GitHub Desktop.
const vscoderevealExtraPlugins = [];
function revealPostInit() {
console.log('[post init] (default)');
}
const vscoderevealExtraPlugins = [
{ src: 'plugin/chalkboard/chalkboard.js' },
{ src: 'plugin/title-footer/title-footer.js', async: true, callback: function () { title_footer.initialize(); } }
];
function setCustomKeys() {
console.log('setting custom keys...');
// clear chalkboard when 'DEL' is pressed
Reveal.addKeyBinding(46, function () {
RevealChalkboard.clear();
});
// reset chalkboard data on current slide when 'BACKSPACE' is pressed
Reveal.addKeyBinding(8, function () {
RevealChalkboard.reset();
});
// toggle chalkboard when 'C' is pressed
Reveal.addKeyBinding(67, function () {
RevealChalkboard.toggleChalkboard();
});
}
function revealPostInit() {
console.log('[post init]');
setCustomKeys();
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// tslint:disable-next-line:no-submodule-imports
const md = require("reveal.js/plugin/markdown/markdown");
exports.renderRevealHtml = (title, extensionOptions, slidesContent) => {
const slides = md.slidify(slidesContent, extensionOptions);
const html = renderTemplate(title, extensionOptions, slides);
return html;
};
const renderTemplate = (title, revealOptions, slides) => {
return `<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>${title}</title>
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/all.min.css">
<link rel="stylesheet" href="css/theme/${revealOptions.theme}.css" id="theme">
${revealOptions.customTheme ? ` <link rel="stylesheet" href="${revealOptions.customTheme}.css" id="theme">` : ''}
<!-- For syntax highlighting -->
<link rel="stylesheet" href="lib/css/${revealOptions.highlightTheme}.css">
${revealOptions.customHighlightTheme ? `<link rel="stylesheet" href="lib/css/${revealOptions.customHighlightTheme}.css">` : ''}
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>
<style type="text/css">
@page {
margin: 0;
size: auto;
}
</style>
<script>
if(window.location.search.match( /print-pdf-now/gi )) {
window.print();
}
</script>
${revealOptions.postInitScript ? `<script src="${revealOptions.postInitScript}"></script>`: ''}
</head>
<body>
<div class="reveal">
<div class="slides">${slides}</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
function extend() {
var target = {};
for (var i = 0; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (source.hasOwnProperty(key)) {
target[key] = source[key];
}
}
}
return target;
}
// Optional libraries used to extend on reveal.js
var deps = [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ 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', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'plugin/math/math.js', async: true }
];
${revealOptions.postInitScript? 'deps = deps.concat(vscoderevealExtraPlugins);' : ''}
// default options to init reveal.js
var defaultOptions = {
controls: true,
progress: true,
history: true,
center: true,
transition: 'default',
dependencies: deps
};
// options from URL query string
var queryOptions = Reveal.getQueryHash() || {};
var options = ${JSON.stringify(revealOptions, null, 2)};
options = extend(defaultOptions, options, queryOptions);
Reveal.initialize(options);
window.onload = () => {
${revealOptions.postInitScript? 'revealPostInit();' : ''}
console.log('window loaded; custom js: ', '${revealOptions.postInitScript}');
}
</script>
</body>
</html>`;
};
//# sourceMappingURL=Template.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// tslint:disable-next-line:no-submodule-imports
const md = require("reveal.js/plugin/markdown/markdown");
exports.renderRevealHtml = (title, extensionOptions, slidesContent) => {
const slides = md.slidify(slidesContent, extensionOptions);
const html = renderTemplate(title, extensionOptions, slides);
return html;
};
const renderTemplate = (title, revealOptions, slides) => {
return `<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>${title}</title>
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/${revealOptions.theme}.css" id="theme">
${revealOptions.customTheme ? ` <link rel="stylesheet" href="${revealOptions.customTheme}.css" id="theme">` : ''}
<!-- For syntax highlighting -->
<link rel="stylesheet" href="lib/css/${revealOptions.highlightTheme}.css">
${revealOptions.customHighlightTheme ? `<link rel="stylesheet" href="lib/css/${revealOptions.customHighlightTheme}.css">` : ''}
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>
<style type="text/css">
@page {
margin: 0;
size: auto;
}
</style>
<script>
if(window.location.search.match( /print-pdf-now/gi )) {
window.print();
}
</script>
</head>
<body>
<div class="reveal">
<div class="slides">${slides}</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
function extend() {
var target = {};
for (var i = 0; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (source.hasOwnProperty(key)) {
target[key] = source[key];
}
}
}
return target;
}
// Optional libraries used to extend on reveal.js
var deps = [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ 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', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'plugin/math/math.js', async: true }
];
// default options to init reveal.js
var defaultOptions = {
controls: true,
progress: true,
history: true,
center: true,
transition: 'default',
dependencies: deps
};
// options from URL query string
var queryOptions = Reveal.getQueryHash() || {};
var options = ${JSON.stringify(revealOptions, null, 2)};
options = extend(defaultOptions, options, queryOptions);
Reveal.initialize(options);
</script>
</body>
</html>`;
};
//# sourceMappingURL=Template.js.map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment