Skip to content

Commit 503dcf6

Browse files
jmooringbep
authored andcommitted
internal/warpc: Enable KaTeX mhchem extension
1 parent 5dd0ba0 commit 503dcf6

File tree

6 files changed

+24
-16
lines changed

6 files changed

+24
-16
lines changed

internal/warpc/js/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"license": "ISC",
1010
"description": "",
1111
"devDependencies": {
12-
"katex": "^0.16.11"
12+
"katex": "^0.16.21"
1313
}
1414
}

internal/warpc/js/renderkatex.bundle.js

+15-15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/warpc/js/renderkatex.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { readInput, writeOutput } from './common';
22
import katex from 'katex';
3+
import 'katex/contrib/mhchem/mhchem.js';
34

45
const render = function (input) {
56
const data = input.data;

internal/warpc/warpc_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ func TestKatex(t *testing.T) {
7777
c.Assert(result.GetID(), qt.Equals, id)
7878
})
7979

80+
c.Run("Chemistry", func(c *qt.C) {
81+
id := uint32(32)
82+
result, err := runExpression(c, id, "C_p[\\ce{H2O(l)}] = \\pu{75.3 J // mol K}")
83+
c.Assert(err, qt.IsNil)
84+
c.Assert(result.GetID(), qt.Equals, id)
85+
})
86+
8087
c.Run("Invalid expression", func(c *qt.C) {
8188
id := uint32(32)
8289
result, err := runExpression(c, id, "c & \\foo\\")

internal/warpc/wasm/greet.wasm

42 Bytes
Binary file not shown.

internal/warpc/wasm/renderkatex.wasm

63 KB
Binary file not shown.

0 commit comments

Comments
 (0)