diff --git a/public/js/assistant/citations.js b/public/js/assistant/citations.js index 0d0b8d2..bc9cfd0 100644 --- a/public/js/assistant/citations.js +++ b/public/js/assistant/citations.js @@ -96,10 +96,8 @@ function formatCitationCluster(nums) { export function normalizeMarkdownText(text) { return stripOrphanMarkdownMarkers(normalizeTableSourceCitationCells(String(text || '') .replace(/\r\n/g, '\n') - .replace(/(\[(?:\d+\s*,\s*)*\d+\])\s*[-–—]\s*/g, '$1\n- ') .replace(/([.!?])\s*[-–—]\s+(\*\*)?/g, '$1\n- $2') .replace(/(:)\s*[-–—]\s+(\*\*)?/g, '$1\n- $2') - .replace(/(\[(?:\d+\s*,\s*)*\d+\]\.)\s+(\d+\.\s+[A-Z][A-Za-z][^\n]{0,80})/g, '$1\n$2') .replace(/([.!?])\s+(\d+\.\s+[A-Z][A-Za-z][^\n]{0,80})/g, '$1\n$2') .replace(/([^\n])\s+(#{1,4}\s+)/g, '$1\n\n$2') .replace(/(#{1,4}\s+[^\n]+?)\s+(-\s+)/g, '$1\n\n$2') diff --git a/test/assistant-citations.test.js b/test/assistant-citations.test.js index 76f0cea..6a5d58b 100644 --- a/test/assistant-citations.test.js +++ b/test/assistant-citations.test.js @@ -105,12 +105,11 @@ test('normalizes old saved assistant answer formatting', async () => { assert.match(html, /Key Differences/); }); -test('repairs smashed admission bullet list after citations', async () => { +test('does not turn citation-delimited prose into a list', async () => { const { renderAssistantMarkdown } = await loadCitationModule(); - const html = renderAssistantMarkdown('Admission is indicated for: Apnoea [1, 2]- **Persistent oxygen saturation <90%** [1, 2]- **Severe respiratory distress** [1]', sources); - assert.match(html, /