A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: ensure valid ranges for delimiter in parseLatex function (#4513)
Myles Scolnickc98ffe8dbe5a
diff --git a/frontend/src/core/codemirror/language/latex.ts b/frontend/src/core/codemirror/language/latex.tsindex 87f1d06bac..eda32cd858 100644--- a/frontend/src/core/codemirror/language/latex.ts+++ b/frontend/src/core/codemirror/language/latex.ts@@ -231,13 +231,21 @@ export function parseLatex(latexParser: Parser): MarkdownConfig {// Test if the node type is one of the math expressionconst delimiterLength = DELIMITER_LENGTH[node.type.name];if (delimiterLength) {+ const from = node.from + delimiterLength;+ const to = node.to - delimiterLength;++ // Ensure valid ranges+ if (from >= to || from < 0 || to < 0) {+ return null;+ }+return {parser: latexParser,// Remove delimiter from LaTeX parser otherwise it won't be highlightedoverlay: [{- from: node.from + delimiterLength,- to: node.to - delimiterLength,+ from,+ to,},],};