diff --git a/public/js/assistant/citations.js b/public/js/assistant/citations.js
index b03305e6..0d0b8d22 100644
--- a/public/js/assistant/citations.js
+++ b/public/js/assistant/citations.js
@@ -101,7 +101,6 @@ export function normalizeMarkdownText(text) {
.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(/(\[(?:\d+\s*,\s*)*\d+\])(?=\s*(?:[A-Z][A-Za-z]+\s+){1,4}(?:deficits?|distress|apnoea|apnea|vomiting|seizures?|signs?|symptoms?|criteria|indications?|risk|oxygen|saturation|dehydration|lethargy|toxicity)\b)/g, '$1\n')
.replace(/([^\n])\s+(#{1,4}\s+)/g, '$1\n\n$2')
.replace(/(#{1,4}\s+[^\n]+?)\s+(-\s+)/g, '$1\n\n$2')
.replace(/(#{1,4}\s+[^\n]+)\n(-\s+)/g, '$1\n\n$2')
diff --git a/test/assistant-citations.test.js b/test/assistant-citations.test.js
index 8a2a5c09..76f0cea3 100644
--- a/test/assistant-citations.test.js
+++ b/test/assistant-citations.test.js
@@ -113,6 +113,13 @@ test('repairs smashed admission bullet list after citations', async () => {
assert.doesNotMatch(html, /\]-/);
});
+test('keeps citations inline before clinical terms', async () => {
+ const { renderAssistantMarkdown } = await loadCitationModule();
+ const html = renderAssistantMarkdown('Assess for lethargy [1] and dehydration [2].', sources);
+ assert.match(html, /lethargy ]*>src<\/a> and dehydration ]*>src<\/a>/);
+ assert.doesNotMatch(html, /<\/a>
\s*and dehydration/);
+});
+
test('repairs smashed head injury red flag bullets after citation clusters', async () => {
const { renderAssistantMarkdown } = await loadCitationModule();
const html = renderAssistantMarkdown('CT is indicated for: [1, 2, 3]- Focal neurologic deficits [1]- Signs of skull fracture [2]- Recurrent vomiting [3]', sources);