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 mhchem #3311

Merged
merged 2 commits into from
Jan 2, 2025
Merged

Add mhchem #3311

merged 2 commits into from
Jan 2, 2025

Conversation

LioSergent
Copy link
Contributor

@LioSergent LioSergent commented Dec 30, 2024

📝 Summary

I would like to be able to write chemical equations conveniently in marimo.

This pull request is an attempt at including katex' mhchem extension, which allows for convenient chemical writing through \ce command, but also clean physical unit typesetting with the \pu command (somewhat similar to siunitx in latex).

Related to https://discordapp.com/channels/1059888774789730424/1318274202507284531

Note : this is the first time I'm trying to contribute to an open-source project, and I honestly don't really know what I am doing, but since the change is very small, I thought I could try. I just tried to make https://katex.org/docs/node#using-mhchem-extension work.

🔍 Description of Changes

  • import katex' mhchem extension
  • also add a note on katex in markdown tutorial

📋 Checklist

  • I have read the contributor guidelines.
  • I have added tests for the changes made. => no tests for this module at this point
  • I have run the code and verified that it works as expected.

I have not tested for performance. Not sure how to test for that. In case it bloats the app, maybe it should be set as an option, or marimo could detect if \ce or \pu is written somewhere.

Note: for comparison, Jupyter uses Mathjax which also allows for mhchem functionality through an extension. The extension isn't loaded by default (although it's very easy to load, either in a cell via "$$\require{mhchem}$$" or through the user's ipython config).
However, another example, obsidian.md (the note-taking app I use) also uses Mathjax, and does load mhchem by default.
Not sure why KaTeX chose to put mhchem commands \ce and \pu as an extension. mhchem feels like just a convenient (and thin) wrapper around things like \mathrm.

📜 Reviewers

@mscolnick

Copy link

vercel bot commented Dec 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marimo-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 1, 2025 8:26pm
marimo-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 1, 2025 8:26pm

Copy link

github-actions bot commented Dec 30, 2024

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@akshayka
Copy link
Contributor

@LioSergent, thanks for the PR! Can you sign the CLA by adding a comment with the following line?

I have read the CLA Document and I hereby sign the CLA

@akshayka akshayka requested a review from mscolnick December 30, 2024 18:10
@LioSergent
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

Copy link
Contributor

@akshayka akshayka left a comment

Choose a reason for hiding this comment

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

The failing test is unrelated — got unlucky with a test that fails just once a year! Thanks for the change, and happy new year!

@akshayka akshayka merged commit 09ea9ae into marimo-team:main Jan 2, 2025
19 of 30 checks passed
Copy link

github-actions bot commented Jan 2, 2025

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.10.10-dev4

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.

3 participants