1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
//! Just a superbasic wrapper around the katex-rs crate specifying preset options

use katex;

pub fn process_katex(katex: &str) -> Result<String, katex::Error> {
    let opts = katex::Opts::builder()
        .display_mode(true)
        .output_type(katex::OutputType::HtmlAndMathml)
        .fleqn(true)
        .leqno(false)
        .throw_on_error(false)
        .trust(true) // We are precompiling the code, so no risk of js changing anything
        .build()
        .unwrap();

    katex::render_with_opts(katex, opts)
}