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

Mathematical equations in h5p (via mathjax) #145

Open
fleisck opened this issue Oct 13, 2023 · 3 comments
Open

Mathematical equations in h5p (via mathjax) #145

fleisck opened this issue Oct 13, 2023 · 3 comments

Comments

@fleisck
Copy link

fleisck commented Oct 13, 2023

Hi,

Is there a way to support rendering of mathematical expressions in the h5p-standalone system. For the traditional system such as via moodle and drupal it requires changes in their server configuration (https://h5p.org/mathematical-expressions). For the offline editor lumi it is enough to copy the content of: https://h5p.org/sites/default/files/h5p-math-display-1.0.7.h5p into my own h5p file.

For the standalone I wasn't able to figure out how to get this working, but did not really know where to start other than extracting h5p-math-display-1.0.7.h5p into the project folder. I assume it requires some changes to h5p-standalone to activate the mathjax parsing?

Thanks already in advance for all the work on h5p-standalone

Karsten

@justineuro
Copy link

The h5p.json file in the project folder has to be edited to indicate the addition of the H5P.MathDisplay-1.0 folder in the project folder. Maybe something similar to the following edit should be carried out towards the end of the h5p.json:

... ,{"machineName":"H5P.MathDisplay","majorVersion":"1","minorVersion":"0"}]}

@justineuro
Copy link

An alternative to adding the H5P.MathDisplay-1.0 folder that worked for me, is adding a customJs line for the MathJax.js in the const options = { ... }, when initializing the H5P. A simple index.html file would be similar to:

<div id='h5p-container'></div>
<script type="text/javascript" src="dist/main.bundle.js"></script>
<script type="text/javascript">
const el = document.getElementById('h5p-container');
const options = {
	h5pJsonPath:  '/path/to/unzipped/h5p-folder',
	frameJs: 'dist/frame.bundle.js',
	frameCss: 'dist/styles/h5p.css',
	customJs: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/latest.js?config=TeX-AMS-MML_HTMLorMML',
}
new H5PStandalone.H5P(el, options);
</script>

@IECharo
Copy link

IECharo commented Jun 28, 2024

Thank you @justineuro, your help has been great for me!

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

No branches or pull requests

3 participants