diff --git a/.changeset/cold-berries-tan.md b/.changeset/cold-berries-tan.md new file mode 100644 index 0000000000..bd006344a8 --- /dev/null +++ b/.changeset/cold-berries-tan.md @@ -0,0 +1,5 @@ +--- +'@udecode/plate-math': patch +--- + +Add `getEquationHtml` diff --git a/packages/math/src/lib/utils/getEquationHtml.ts b/packages/math/src/lib/utils/getEquationHtml.ts new file mode 100644 index 0000000000..574ab7c062 --- /dev/null +++ b/packages/math/src/lib/utils/getEquationHtml.ts @@ -0,0 +1,11 @@ +import katex, { type KatexOptions } from 'katex'; + +import type { TEquationElement } from '../../lib'; + +export const getEquationHtml = ({ + element, + options, +}: { + element: TEquationElement; + options?: KatexOptions; +}) => katex.renderToString(element.texExpression, options);