UNPKG

webforai

Version:

A library that provides a web interface for AI

14 lines (13 loc) 376 B
// src/mdast-handlers/math-handler.ts import { toHtml } from "hast-util-to-html"; import { MathMLToLaTeX } from "mathml-to-latex"; var mathHandler = (state, node) => { const mathMl = toHtml(node); const latex = MathMLToLaTeX.convert(mathMl); const result = { type: "inlineMath", value: latex }; state.patch(node, result); return result; }; export { mathHandler };