Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to render maths in reveal.js slides #80

Merged
merged 2 commits into from
Nov 14, 2024

Conversation

raar1
Copy link
Collaborator

@raar1 raar1 commented Nov 13, 2024

This PR finally adds back the reveal math plugin for rendering LaTex in slides. This used to work in the old version of this framework (before porting to nuxt3) but then started failing with mysterious "Plugin not found" errors if the page was reloaded when a slide deck was present. It therefore got commented out for a long time but now I actually need to use it...

After a lot of digging, it turns out that reveal.js/plugin/math/math.js (or reveal.js/plugin/math/math.esm.js, it doesn't seem to matter) relies on a variable called Plugin that is used to switch between any of the 3 available LaTex backends. For a reason that have to do with js, nuxt or vite dependency caching, ssr (or who knows), this variable does not exist anymore when the page is reloaded. Note that the other internal reveal plugins all work fine on page reload so I'm not sure what is wrong.

In any case, I now import that plugin asynchronously on the client side only and that makes everything work happily again.

Copy link
Collaborator

@JaroCamphuijsen JaroCamphuijsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you for adding this very intuitive import.

@raar1 raar1 merged commit 395bd59 into main Nov 14, 2024
1 check passed
@raar1 raar1 deleted the add_formula_rendering_for_slides branch November 14, 2024 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants