import { describe, expect, it } from 'vitest' import { renderChangelogMarkdown } from './markdown' describe('renderChangelogMarkdown', () => { it('renders headings, lists, bold, code and links', () => { const md = ['### Features', '- add **two-way** sync', '- speed up `jumpRail`', '', '[issue](https://example.com/1)'].join('\n') const html = renderChangelogMarkdown(md) expect(html).toContain('
jumpRail')
expect(html).toMatch(/]*href="https:\/\/example\.com\/1"[^>]*>issue<\/a>/)
expect(html).toContain('target="_blank"')
expect(html).toContain('rel="noopener noreferrer"')
})
it('renders fenced code blocks and horizontal rules', () => {
const html = renderChangelogMarkdown(['---', '```bash', 'docker pull x', '```'].join('\n'))
expect(html).toContain('docker pull x')
})
it('strips dangerous markup', () => {
const html = renderChangelogMarkdown('\n[x](javascript:alert(1))')
expect(html).not.toContain('