Home / GitHub Page

Feature request: implementation of the mhchem extension to KaTex

It would be very helpful if the mhchem extension to the KaTex editor could be added to Joplin.
So that it is easy to add chemical reactions when using Joplin for laboratory note-taking.
Best,
Stefan

@laurent would you accept a pull request for this? From the Katex plugin page it looks like we’ll just need to include another script to add support for this.

Yes if you can figure it out I’d accept a PR. I think it would be a bit more complicated as we need to include the script conditionally depending on whether Katex is enabled or not. Also we’d need to somehow bundle this script with the two apps (mobile and desktop) as it needs to work offline too.

If possible I think the best way would be to include and run this plugin at rendering time (like Katex now), and that way we don’t need to load an external script in the HTML view, and it works directly in both desktop and mobile.

Thanks for the notes @laurent I spent a couple of hours this morning trying to get it working, but it looks like the plugin doesn’t properly support node yet…
We might need to wait for this plugin to mature before adding it.

Ok thanks for checking @CalebJohn, let’s wait and see if it gets improved then.

I’ve ended up wrapping their JS file in a function so that it can be imported into Joplin, so next version will support mhchem.

image

Much easier than I realized! Looks like I need to brush up on my javascript! Nice work @laurent

Sound great @laurent!
Looking forward to the new version :wink:
Thanks!