Skip to content
Snippets Groups Projects
Commit 3742b5e2 authored by dj44vuri's avatar dj44vuri
Browse files

iCode Seminar

parents
Branches main
No related tags found
No related merge requests found
Showing
with 276 additions and 0 deletions
/**
* A plugin which enables rendering of math equations inside
* of reveal.js slides. Essentially a thin wrapper for MathJax.
*
* @author Hakim El Hattab
*/
export const MathJax2 = () => {
// The reveal.js instance this plugin is attached to
let deck;
let defaultOptions = {
messageStyle: 'none',
tex2jax: {
inlineMath: [ [ '$', '$' ], [ '\\(', '\\)' ] ],
skipTags: [ 'script', 'noscript', 'style', 'textarea', 'pre' ]
},
skipStartupTypeset: true
};
function loadScript( url, callback ) {
let head = document.querySelector( 'head' );
let script = document.createElement( 'script' );
script.type = 'text/javascript';
script.src = url;
// Wrapper for callback to make sure it only fires once
let finish = () => {
if( typeof callback === 'function' ) {
callback.call();
callback = null;
}
}
script.onload = finish;
// IE
script.onreadystatechange = () => {
if ( this.readyState === 'loaded' ) {
finish();
}
}
// Normal browsers
head.appendChild( script );
}
return {
id: 'mathjax2',
init: function( reveal ) {
deck = reveal;
let revealOptions = deck.getConfig().mathjax2 || deck.getConfig().math || {};
let options = { ...defaultOptions, ...revealOptions };
let mathjax = options.mathjax || 'https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js';
let config = options.config || 'TeX-AMS_HTML-full';
let url = mathjax + '?config=' + config;
options.tex2jax = { ...defaultOptions.tex2jax, ...revealOptions.tex2jax };
options.mathjax = options.config = null;
loadScript( url, function() {
MathJax.Hub.Config( options );
// Typeset followed by an immediate reveal.js layout since
// the typesetting process could affect slide height
MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub, deck.getRevealElement() ] );
MathJax.Hub.Queue( deck.layout );
// Reprocess equations in slides when they turn visible
deck.on( 'slidechanged', function( event ) {
MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub, event.currentSlide ] );
} );
} );
}
}
};
/**
* A plugin which enables rendering of math equations inside
* of reveal.js slides. Essentially a thin wrapper for MathJax 3
*
* @author Hakim El Hattab
* @author Gerhard Burger
*/
export const MathJax3 = () => {
// The reveal.js instance this plugin is attached to
let deck;
let defaultOptions = {
tex: {
inlineMath: [ [ '$', '$' ], [ '\\(', '\\)' ] ]
},
options: {
skipHtmlTags: [ 'script', 'noscript', 'style', 'textarea', 'pre' ]
},
startup: {
ready: () => {
MathJax.startup.defaultReady();
MathJax.startup.promise.then(() => {
Reveal.layout();
});
}
}
};
function loadScript( url, callback ) {
let script = document.createElement( 'script' );
script.type = "text/javascript"
script.id = "MathJax-script"
script.src = url;
script.async = true
// Wrapper for callback to make sure it only fires once
script.onload = () => {
if (typeof callback === 'function') {
callback.call();
callback = null;
}
};
document.head.appendChild( script );
}
return {
id: 'mathjax3',
init: function(reveal) {
deck = reveal;
let revealOptions = deck.getConfig().mathjax3 || {};
let options = {...defaultOptions, ...revealOptions};
options.tex = {...defaultOptions.tex, ...revealOptions.tex}
options.options = {...defaultOptions.options, ...revealOptions.options}
options.startup = {...defaultOptions.startup, ...revealOptions.startup}
let url = options.mathjax || 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js';
options.mathjax = null;
window.MathJax = options;
loadScript( url, function() {
// Reprocess equations in slides when they turn visible
Reveal.addEventListener( 'slidechanged', function( event ) {
MathJax.typeset();
} );
} );
}
}
};
import {KaTeX} from "./katex";
import {MathJax2} from "./mathjax2";
import {MathJax3} from "./mathjax3";
const defaultTypesetter = MathJax2;
/*!
* This plugin is a wrapper for the MathJax2,
* MathJax3 and KaTeX typesetter plugins.
*/
export default Plugin = Object.assign( defaultTypesetter(), {
KaTeX,
MathJax2,
MathJax3
} );
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
name: PdfExport
script: pdfexport.js
.reveal
div.sourceCode
pre
code.has-line-highlights
> span:not(.highlight-line) {
opacity: 0.4;
}
.reveal pre.numberSource {
padding-left: 0;
}
.reveal pre.numberSource code > span {
left: -2.1em;
}
pre.numberSource code > span > a:first-child::before {
left: -0.7em;
}
.reveal pre > code:not(:first-child).fragment {
position: absolute;
top: 0;
left: 0;
width: 100%;
box-sizing: border-box;
}
.reveal div.sourceCode pre code {
min-height: 100%;
}
# adapted from https://github.com/hakimel/reveal.js/tree/master/plugin/highlight
name: QuartoLineHighlight
script: line-highlight.js
stylesheet: line-highlight.css
This diff is collapsed.
name: QuartoSupport
script: support.js
stylesheet: footer.css
config:
smaller: false
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
name: RevealMenu
script: [menu.js, quarto-menu.js]
stylesheet: [menu.css, quarto-menu.css]
config:
menu:
side: "left"
useTextContentForMissingTitles: true
markers: false
loadIcons: false
This diff is collapsed.
window.revealMenuToolHandler = function (handler) {
return function (event) {
event.preventDefault();
handler();
Reveal.getPlugin("menu").closeMenu();
};
};
window.RevealMenuToolHandlers = {
fullscreen: revealMenuToolHandler(function () {
const element = document.documentElement;
const requestMethod =
element.requestFullscreen ||
element.webkitRequestFullscreen ||
element.webkitRequestFullScreen ||
element.mozRequestFullScreen ||
element.msRequestFullscreen;
if (requestMethod) {
requestMethod.apply(element);
}
}),
speakerMode: revealMenuToolHandler(function () {
Reveal.getPlugin("notes").open();
}),
keyboardHelp: revealMenuToolHandler(function () {
Reveal.toggleHelp(true);
}),
overview: revealMenuToolHandler(function () {
Reveal.toggleOverview(true);
}),
toggleChalkboard: revealMenuToolHandler(function () {
RevealChalkboard.toggleChalkboard();
}),
toggleNotesCanvas: revealMenuToolHandler(function () {
RevealChalkboard.toggleNotesCanvas();
}),
downloadDrawings: revealMenuToolHandler(function () {
RevealChalkboard.download();
}),
togglePdfExport: revealMenuToolHandler(function () {
PdfExport.togglePdfExport();
}),
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment