Skip to content

Commit

Permalink
Merge pull request #80 from esciencecenter-digital-skills/add_formula…
Browse files Browse the repository at this point in the history
…_rendering_for_slides

Add ability to render maths in reveal.js slides
  • Loading branch information
raar1 authored Nov 14, 2024
2 parents 6fadaf9 + 68fda46 commit 395bd59
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions components/Slides.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
</template>

<script lang="ts">
export default {
props: {
slidescontent: {
Expand Down Expand Up @@ -41,7 +42,6 @@ export default {
import RevealMarkdown from "reveal.js/plugin/markdown/markdown.esm.js";
import RevealNotes from "reveal.js/plugin/notes/notes.js";
// import RevealMath from 'reveal.js/plugin/math/math.js'
import Search from "reveal.js/plugin/search/search.esm.js";
import Decorations from "~/assets/nlesc-decorations.js";
Expand All @@ -50,18 +50,23 @@ onMounted(() => {
// On client side only, dynamically load reveal.js
// (Importing statically causes errors during server side rendering)
// For different (unclear) reasons, importing RevealMath alongside
// the other plugins causes a "Plugin not found" error if the page
// is reloaded. Therefore it is also imported async here.
if (process.browser) {
import("reveal.js").then((revealModule) => {
const deck = new revealModule.default();
deck.initialize({
controls: true,
progress: true,
center: true,
hash: true,
transition: "none",
embedded: true,
showNotes: true,
plugins: [RevealMarkdown, RevealNotes, Decorations, Search],
import("reveal.js/plugin/math/math.esm.js").then((RevealMath) => {
const deck = new revealModule.default();
deck.initialize({
controls: true,
progress: true,
center: true,
hash: true,
transition: "none",
embedded: true,
showNotes: true,
plugins: [RevealMarkdown, RevealMath.default, RevealNotes, Decorations, Search],
});
});
});
}
Expand Down

0 comments on commit 395bd59

Please sign in to comment.