katex-rs icon indicating copy to clipboard operation
katex-rs copied to clipboard

`katex` built with`duktape` failed to render `vmatrix` correctly

Open SichangHe opened this issue 2 years ago • 5 comments

If I use katex with:

katex = { version = "0.4.5", default-features = false, features = ["duktape"] }

then, matrix expressions like

\begin{vmatrix}a&b\\c&d\end{vmatrix}

results in an error:

JsExecError("undefined not callable (property 'fill' of [object Array]): JavaScript runtime error (TypeError)")

See this issue on mdbook-katex for more.

SichangHe avatar Nov 24 '22 16:11 SichangHe

There is no much I can do in term of issues in the JS engine.

The biggest problem of this crate is that there currently lacks of a well-maintained embedded JS engine (incl. its corresponding Rust binding). See #6 for more details.

xu-cheng avatar Nov 24 '22 22:11 xu-cheng

What is your take of requiring the user to have other dependencies such as node or even katex CLI?

SichangHe avatar Nov 24 '22 22:11 SichangHe

If you don't mind the dependency's size, V8 engine using rusty_v8 is the best approach. PR is welcomed to add this new backend.

xu-cheng avatar Nov 24 '22 22:11 xu-cheng

Noted that node uses V8 engine internally.

xu-cheng avatar Nov 24 '22 22:11 xu-cheng

I don't like the idea of embedding V8… It is quite an overkill for the simple functionality katex is supposed to provide. What I was suggesting is that we call command npx katex or something like that.

SichangHe avatar Nov 24 '22 22:11 SichangHe