@@ -318,4 +318,38 @@ $$\n\\pi_n(\\mathbb{S}^3) = \\begin{cases}
318318 // mhchem-escape would insert a backslash here.
319319 expect ( output ) . toBe ( 'mchem pu:\n$\\pu{-572 kJ mol^{-1}}$' ) ;
320320 } ) ;
321+
322+ test ( 'LaTeX in blockquotes with display math' , ( ) => {
323+ const input =
324+ '> **Definition (limit):** \n> \\[\n> \\lim_{x\\to a} f(x) = L\n> \\]\n> means that as \\(x\\) gets close to \\(a\\).' ;
325+ const output = preprocessLaTeX ( input ) ;
326+
327+ // Blockquote markers should be preserved, LaTeX should be converted
328+ expect ( output ) . toContain ( '> **Definition (limit):**' ) ;
329+ expect ( output ) . toContain ( '$$' ) ;
330+ expect ( output ) . toContain ( '$x$' ) ;
331+ expect ( output ) . not . toContain ( '\\[' ) ;
332+ expect ( output ) . not . toContain ( '\\]' ) ;
333+ expect ( output ) . not . toContain ( '\\(' ) ;
334+ expect ( output ) . not . toContain ( '\\)' ) ;
335+ } ) ;
336+
337+ test ( 'LaTeX in blockquotes with inline math' , ( ) => {
338+ const input =
339+ "> The derivative \\(f'(x)\\) at point \\(x=a\\) measures slope.\n> Formula: \\(f'(a)=\\lim_{h\\to 0}\\frac{f(a+h)-f(a)}{h}\\)" ;
340+ const output = preprocessLaTeX ( input ) ;
341+
342+ // Blockquote markers should be preserved, inline LaTeX converted to $...$
343+ expect ( output ) . toContain ( "> The derivative $f'(x)$ at point $x=a$ measures slope." ) ;
344+ expect ( output ) . toContain ( "> Formula: $f'(a)=\\lim_{h\\to 0}\\frac{f(a+h)-f(a)}{h}$" ) ;
345+ } ) ;
346+
347+ test ( 'Mixed content with blockquotes and regular text' , ( ) => {
348+ const input =
349+ 'Regular text with \\(x^2\\).\n\n> Quote with \\(y^2\\).\n\nMore text with \\(z^2\\).' ;
350+ const output = preprocessLaTeX ( input ) ;
351+
352+ // All LaTeX should be converted, blockquote markers preserved
353+ expect ( output ) . toBe ( 'Regular text with $x^2$.\n\n> Quote with $y^2$.\n\nMore text with $z^2$.' ) ;
354+ } ) ;
321355} ) ;
0 commit comments