From bd877592c048c158ad7379e93ac414a5568c2d9d Mon Sep 17 00:00:00 2001 From: JK Date: Thu, 26 Mar 2026 21:05:20 +0100 Subject: [PATCH] fix(equations): enhance handling of list sections in equation processing --- src/features/equations/provider-equation.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/features/equations/provider-equation.ts b/src/features/equations/provider-equation.ts index 3845cba..64cf6f9 100644 --- a/src/features/equations/provider-equation.ts +++ b/src/features/equations/provider-equation.ts @@ -83,16 +83,18 @@ export class ActiveNoteEquationProvider { } equations.push(eq); } - else if (section.type === 'callout' || section.type === 'blockquote') { + else if (section.type === 'callout' || section.type === 'blockquote' || section.type === 'list') { const text = content.slice(section.position.start.offset, section.position.end.offset); - const lines = text.split(/\r?\n/); - // Improved regex to strip blockquote markers - const cleanLines = lines.map(l => l.replace(/^\s*>\s?/, '')); - const cleanText = cleanLines.join('\n'); + let processedText = text; + // For callouts/blockquote, strip blockquote markers + if (section.type === 'callout' || section.type === 'blockquote') { + const lines = text.split(/\r?\n/); + const cleanLines = lines.map(l => l.replace(/^\s*>\s?/, '')); + processedText = cleanLines.join('\n'); + } // Handle split/lazy blockquotes (odd number of $$) by appending a closing one - let processedText = cleanText; if ((processedText.match(/\$\$/g) || []).length % 2 !== 0) { processedText += '\n$$'; }