observablehq / feedback

Customer submitted bugs and feature requests
42 stars 3 forks source link

Please add support for mhchem KaTeX extension #642

Open saf-dmitry opened 1 month ago

saf-dmitry commented 1 month ago

Is your feature request related to a problem? Please describe. I very often need to add chemical reactions, like $\ce{C + O2 -> CO2}$, and quantities with units, like $\pu{1.23 kg.m^{-3}}$, to my notebooks.

Describe the solution you'd like Please load the mhchem KaTeX extension, so it can be used in notebooks.

Describe alternatives you've considered Since the mhchem extension for KaTeX exists and works just fine (in other environments, which autoload the mhchem extension), no other alternatives considered.

Additional context The examples above are rendered by GitHub using the mhchem extension for MathJax.

mbostock commented 1 month ago

For what it’s worth, mhchem already works in Observable Framework. You can load it like so:

```js
import tex from "npm:@observablehq/tex";
import "npm:katex/contrib/mhchem/mhchem.js/+esm";