diff --git a/package.json b/package.json index bc9f0472..222d006c 100644 --- a/package.json +++ b/package.json @@ -54,14 +54,14 @@ }, "dependencies": { "hightable": "0.16.0", - "hyparquet": "1.14.0", + "hyparquet": "1.15.0", "hyparquet-compressors": "1.1.1", "icebird": "0.3.0", "react": "18.3.1", "react-dom": "18.3.1" }, "devDependencies": { - "@eslint/js": "9.27.0", + "@eslint/js": "9.28.0", "@storybook/addon-essentials": "8.6.14", "@storybook/addon-interactions": "8.6.14", "@storybook/blocks": "8.6.14", @@ -69,12 +69,12 @@ "@storybook/react-vite": "8.6.14", "@storybook/test": "8.6.14", "@testing-library/react": "16.3.0", - "@types/node": "22.15.21", - "@types/react": "19.1.5", + "@types/node": "22.15.29", + "@types/react": "19.1.6", "@types/react-dom": "19.1.5", "@vitejs/plugin-react": "4.5.0", "@vitest/coverage-v8": "3.1.4", - "eslint": "9.27.0", + "eslint": "9.28.0", "eslint-plugin-react": "7.37.5", "eslint-plugin-react-hooks": "5.2.0", "eslint-plugin-react-refresh": "0.4.20", @@ -85,7 +85,7 @@ "npm-run-all": "4.1.5", "storybook": "8.6.14", "typescript": "5.8.3", - "typescript-eslint": "8.32.1", + "typescript-eslint": "8.33.0", "vite": "6.3.5", "vitest": "3.1.4" }, diff --git a/src/components/Markdown/Markdown.test.tsx b/src/components/Markdown/Markdown.test.tsx index a6ffe1e9..d52df16d 100644 --- a/src/components/Markdown/Markdown.test.tsx +++ b/src/components/Markdown/Markdown.test.tsx @@ -351,4 +351,15 @@ describe('Markdown with nested elements', () => { expect(container.textContent).toBe('[link]') expect(container.querySelector('a')).toBeNull() }) + + it('renders a list immediately after a paragraph', () => { + const text = 'List:\n - First\n - Second' + const { getByText } = render() + expect(getByText('First')).toBeDefined() + expect(getByText('Second')).toBeDefined() + expect(getByText('List:')).toBeDefined() + expect(getByText('List:').tagName).toBe('P') + expect(getByText('First').tagName).toBe('LI') + expect(getByText('Second').tagName).toBe('LI') + }) }) diff --git a/src/components/Markdown/Markdown.tsx b/src/components/Markdown/Markdown.tsx index 65dfefe3..f42564f5 100644 --- a/src/components/Markdown/Markdown.tsx +++ b/src/components/Markdown/Markdown.tsx @@ -100,12 +100,18 @@ function parseMarkdown(text: string): Token[] { // Paragraph const paraLines: string[] = [] - while (i < lines.length && lines[i]?.trim() !== '') { - const line = lines[i] - if (line === undefined) { - throw new Error(`Index ${i} not found in lines`) - } - paraLines.push(line) + while (i < lines.length) { + const ln = lines[i] + if (ln === undefined) throw new Error(`Index ${i} not found in lines`) + + // stop if we hit a blank line or something that starts its own block + if (!ln.trim()) break + if (ln.startsWith('```')) break // code block + if (ln.startsWith('>')) break // blockquote + if (/^(#{1,6})\s+/.test(ln)) break // heading + if (/^(\s*)([-*+]|\d+\.)\s+/.test(ln)) break // list item + + paraLines.push(ln) i++ } tokens.push({