Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(md): align our latex regex with gfm whitespace rules (#2571)

Seamus622288d9df3c
diff --git a/js/app/packages/lexical-core/transformers/katex.ts b/js/app/packages/lexical-core/transformers/katex.ts
index 5c9c2ef0fe..8236baaee1 100644
--- a/js/app/packages/lexical-core/transformers/katex.ts
+++ b/js/app/packages/lexical-core/transformers/katex.ts
@@ -50,8 +50,10 @@ export const I_EQUATION_NODE: TextMatchTransformer = {
export const E_INLINE_EQUATION_NODE: TextMatchTransformer = {
dependencies: [EquationNode],
type: 'text-match',
- regExp: /(?<!\$)\$[^\n$]*?(?:[a-zA-Z\\=+\-*/^][^\n$]*?)\$(?!\$|\d)/,
- importRegExp: /(?<!\$)\$[^\n$]*?(?:[a-zA-Z\\=+\-*/^][^\n$]*?)\$(?!\$|\d)/,
+ regExp:
+ /(?<!\$)\$(?!\s)[^\n$]*?(?:[a-zA-Z\\=+\-*/^][^\n$]*?)(?<!\s)\$(?!\$|\d)/,
+ importRegExp:
+ /(?<!\$)\$(?!\s)[^\n$]*?(?:[a-zA-Z\\=+\-*/^][^\n$]*?)(?<!\s)\$(?!\$|\d)/,
export: (node) => {
if (!$isEquationNode(node)) {
return null;