From 33bc04a72234a777071c91086b1b631ee8525141 Mon Sep 17 00:00:00 2001 From: Felix Feng Date: Fri, 20 Dec 2024 22:06:34 +0800 Subject: [PATCH 1/3] Add `getEquationHtml` --- packages/math/src/lib/utils/getEquationHtml.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 packages/math/src/lib/utils/getEquationHtml.ts diff --git a/packages/math/src/lib/utils/getEquationHtml.ts b/packages/math/src/lib/utils/getEquationHtml.ts new file mode 100644 index 0000000000..2386ee0ad2 --- /dev/null +++ b/packages/math/src/lib/utils/getEquationHtml.ts @@ -0,0 +1,15 @@ +import katex, { type KatexOptions } from 'katex'; + +import type { TEquationElement } from '../../lib'; + +export const getEquationHtml = ({ + element, + options, +}: { + element: TEquationElement; + options?: KatexOptions; +}) => { + const html = katex.renderToString(element.texExpression, options); + + return html; +}; From 681a1a174c120728c468682d091eb2327b381b04 Mon Sep 17 00:00:00 2001 From: Felix Feng Date: Fri, 20 Dec 2024 22:06:40 +0800 Subject: [PATCH 2/3] changelog --- .changeset/cold-berries-tan.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/cold-berries-tan.md 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` From 174f3603dbb466f306eaa7a9e8313fc29356cb9b Mon Sep 17 00:00:00 2001 From: Felix Feng Date: Fri, 20 Dec 2024 22:08:44 +0800 Subject: [PATCH 3/3] fix --- packages/math/src/lib/utils/getEquationHtml.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/math/src/lib/utils/getEquationHtml.ts b/packages/math/src/lib/utils/getEquationHtml.ts index 2386ee0ad2..574ab7c062 100644 --- a/packages/math/src/lib/utils/getEquationHtml.ts +++ b/packages/math/src/lib/utils/getEquationHtml.ts @@ -8,8 +8,4 @@ export const getEquationHtml = ({ }: { element: TEquationElement; options?: KatexOptions; -}) => { - const html = katex.renderToString(element.texExpression, options); - - return html; -}; +}) => katex.renderToString(element.texExpression, options);