import { describe, expect, it } from 'vitest'; import { renderMarkdownToSafeHtml } from '../../src/artifacts/markdown'; describe('renderMarkdownToSafeHtml', () => { it('renders common markdown blocks', () => { const md = [ '# Title', '', 'Paragraph with **bold** and *italic* and `code`.', '', '- one', '- two', '', '1. first', '2. second', '', '> note line', '', '```', 'const x = 1 < 2;', '```', ].join('\n'); const out = renderMarkdownToSafeHtml(md); expect(out).toContain('

Title

'); expect(out).toContain('

Paragraph with bold and italic and code.

'); expect(out).toContain(''); expect(out).toContain('
  1. first
  2. second
'); expect(out).toContain('
note line
'); expect(out).toContain('
const x = 1 < 2;
'); }); it('escapes raw html', () => { const out = renderMarkdownToSafeHtml(''); expect(out).toContain('<script>alert(1)</script>'); expect(out).not.toContain('