Skip to content

Commit

Permalink
fix #208
Browse files Browse the repository at this point in the history
  • Loading branch information
artisticat1 committed Oct 21, 2023
1 parent d2e1450 commit afc1cb7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/utils/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ export class Context {
if (ctx.mode.code) ctx.codeblockLanguage = codeblockLanguage;

// first, check if math mode should be "generally" on
const inMath = forceMath || (isWithinEquation(state)
);
const inMath = forceMath || isWithinEquation(state);

if (inMath && !forceMath) {
const inInlineEquation = isWithinInlineEquation(state);
Expand Down Expand Up @@ -170,7 +169,7 @@ const isWithinEquation = (state: EditorState):boolean => {
const left = tree.resolveInner(pos - 1, -1);
const right = tree.resolveInner(pos + 1, 1);

return (left.name.contains("math") && right.name.contains("math"));
return (left.name.contains("math") && right.name.contains("math") && !(left.name.contains("math-end")));
}

return (syntaxNode.name.contains("math"));
Expand Down

0 comments on commit afc1cb7

Please sign in to comment.