Skip to content

Commit

Permalink
buggy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vantage-ola committed Dec 18, 2024
1 parent bc1c700 commit 0ad2cd5
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,17 @@ export const EQUATION: TextMatchTransformer = {
if (!$isEquationNode(node)) {
return null;
}

return `$${node.getEquation()}$`;
const equation = node.getEquation();
const isInline = node.isInline();
return isInline ? `$${equation}$` : `$$${equation}$$`;
},
importRegExp: /\$([^$]+?)\$/,
regExp: /\$([^$]+?)\$$/,
importRegExp: /\$([^$]+?)\$|\$\$([^$]+?)\$\$/, // regex issue
regExp: /\$([^$]+?)\$$|\$\$([^$]+?)\$\$$/, // regex issue
replace: (textNode, match) => {
const [, equation] = match;
const equationNode = $createEquationNode(equation, true);
const [, inlineEquation, blockEquation] = match;
const equation = inlineEquation || blockEquation;
const isInline = !!inlineEquation;
const equationNode = $createEquationNode(equation, isInline);
textNode.replace(equationNode);
},
trigger: '$',
Expand Down

0 comments on commit 0ad2cd5

Please sign in to comment.