paprika/src/hljs_tpl.rs
Peter Cai 311b9a0d26
hljs: binding: catch hljs errors when specifying language
the language may not exist. do not crash the entire program due to this
2020-04-12 17:01:45 +08:00

7 lines
315 B
Rust

// Will be loaded by build.rs and add #[wasm_bindgen(inline_js = "...")] here
extern "C" {
#[wasm_bindgen(js_name = "highlightAuto")]
fn hljs_highlight_auto(code: &str) -> JsValue;
#[wasm_bindgen(catch, js_name = "highlight")]
fn hljs_highlight(lang: &str, code: &str) -> Result<JsValue, JsValue>;
}