fraudTech commited on
Commit
ce97d7f
·
1 Parent(s): 4ae5eb5

revert back to Fixed $$ $$ block not rendering 2cc84ae

Browse files
Files changed (1) hide show
  1. web/src/math-preprocessing.ts +3 -8
web/src/math-preprocessing.ts CHANGED
@@ -51,14 +51,9 @@ export function preprocessMathContent(content: string): string {
51
  processed = processed.replace(/\$(\d+)\$/g, '$ $1. $');
52
 
53
  // Step 6: Ensure display math is on its own lines
54
- processed = processed.replace(/\$\$([\s\S]*?)\$\$/g, (match, math, offset) => {
55
  const trimmed = math.trim();
56
- const before = offset > 0 ? processed[offset - 1] : '';
57
- const afterIndex = offset + match.length;
58
- const after = afterIndex < processed.length ? processed[afterIndex] : '';
59
- const prefix = before && before !== '\n' ? '\n' : '';
60
- const suffix = after && after !== '\n' ? '\n' : '';
61
- return `${prefix}$$\n${trimmed}\n$$${suffix}`;
62
  });
63
 
64
  // Step 7: Clean up multiple newlines
@@ -139,4 +134,4 @@ export function sanitizeMathContent(content: string): string {
139
  // (MathJax handles the rest)
140
 
141
  return sanitized;
142
- }
 
51
  processed = processed.replace(/\$(\d+)\$/g, '$ $1. $');
52
 
53
  // Step 6: Ensure display math is on its own lines
54
+ processed = processed.replace(/\$\$([\s\S]*?)\$\$/g, (_match, math) => {
55
  const trimmed = math.trim();
56
+ return `\n$$\n${trimmed}\n$$\n`;
 
 
 
 
 
57
  });
58
 
59
  // Step 7: Clean up multiple newlines
 
134
  // (MathJax handles the rest)
135
 
136
  return sanitized;
137
+ }