diff --git a/apps/web/src/components/ui/report/plugins/markdown-kit/escape-handlers.ts b/apps/web/src/components/ui/report/plugins/markdown-kit/escape-handlers.ts index 08c8a49b2..1b9ba922d 100644 --- a/apps/web/src/components/ui/report/plugins/markdown-kit/escape-handlers.ts +++ b/apps/web/src/components/ui/report/plugins/markdown-kit/escape-handlers.ts @@ -39,5 +39,9 @@ export const preprocessMarkdownForMdx = (markdown: string): string => { // This prevents {avg}, {25%}, {data} etc from being interpreted as JSX expressions processed = processed.replace(/{([^{}]*?)}/g, '{$1}'); + // 3. Escape > characters at start of line that are followed by digits (comparison operators like >500k) + // This prevents them from being interpreted as blockquote syntax + processed = processed.replace(/^>(\d)/gm, '>$1'); + return processed; }; diff --git a/apps/web/src/components/ui/report/plugins/markdown-kit/platejs-conversion.test.ts b/apps/web/src/components/ui/report/plugins/markdown-kit/platejs-conversion.test.ts index e81fdfb1e..015961a89 100644 --- a/apps/web/src/components/ui/report/plugins/markdown-kit/platejs-conversion.test.ts +++ b/apps/web/src/components/ui/report/plugins/markdown-kit/platejs-conversion.test.ts @@ -2041,4 +2041,18 @@ describe('edge case tests for markdown parsing', () => { expect(platejs[0].children[0].text).toContain('array[index]'); expect(platejs[0].children[0].text).toContain('object.{property}'); }); + + it('should parse > at start of line followed by numbers as text, not blockquote', async () => { + const markdown = `### Purchase Motivation + +>500k CLV customers are driven by **competition (58%)** and **fitness (42%)** - no recreational or transportation customers exist in this segment. Meanwhile, <500k CLV customers are primarily **recreational cyclists (76%)**, followed by transportation (14%) and competition (8%). This indicates high-value customers view cycling as a serious sport or fitness pursuit rather than casual recreation. +### Technical Expertise`; + + const platejs = await markdownToPlatejs(editor, markdown); + expect(platejs).toBeDefined(); + expect(platejs[1].type).toBe('metric'); + const contentElement = platejs[2]; + expect(contentElement.type).toBe('p'); + expect(contentElement.children[0].text).toContain('>500k CLV customers are driven by'); + }); });