feat(tui): add markdown rendering utility
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { renderMarkdown } from './markdown.js';
|
||||
|
||||
describe('renderMarkdown', () => {
|
||||
it('renders plain text unchanged', () => {
|
||||
const result = renderMarkdown('Hello world');
|
||||
expect(result).toContain('Hello world');
|
||||
});
|
||||
|
||||
it('renders bold text', () => {
|
||||
const result = renderMarkdown('This is **bold** text');
|
||||
expect(result).toContain('bold');
|
||||
});
|
||||
|
||||
it('renders code blocks', () => {
|
||||
const result = renderMarkdown('```javascript\nconst x = 1;\n```');
|
||||
expect(result).toContain('const');
|
||||
expect(result).toContain('x');
|
||||
});
|
||||
|
||||
it('renders inline code', () => {
|
||||
const result = renderMarkdown('Use `console.log()` for debugging');
|
||||
expect(result).toContain('console.log()');
|
||||
});
|
||||
|
||||
it('renders lists', () => {
|
||||
const result = renderMarkdown('- Item 1\n- Item 2');
|
||||
expect(result).toContain('Item 1');
|
||||
expect(result).toContain('Item 2');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user