Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,27 @@
},
"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",
"@storybook/react": "8.6.14",
"@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",
Expand All @@ -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"
},
Expand Down
11 changes: 11 additions & 0 deletions src/components/Markdown/Markdown.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<Markdown text={text} />)
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')
})
})
18 changes: 12 additions & 6 deletions src/components/Markdown/Markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down