import { ribbit } from './setup'; const lib = ribbit(); const hopdown = new lib.HopDown(); const H = (md: string) => hopdown.toHTML(md); const M = (html: string) => hopdown.toMarkdown(html); const rt = (md: string) => M(H(md)); describe('Markdown → HTML', () => { describe('inline formatting', () => { it('bold', () => expect(H('**bold**')).toBe('
bold
')); it('italic', () => expect(H('*italic*')).toBe('italic
')); it('inline code', () => expect(H('`code`')).toBe('code
bi
')); it('mixed', () => expect(H('a **b** *c* `d`')).toBe('a b c d
a b
')); it('content', () => expect(H('> hello')).toContain('hello')); it('multi-line', () => expect(H('> a\n> b')).toContain('a')); }); describe('fenced code', () => { it('basic', () => expect(H('```\nx = 1\n```')).toContain('')); it('content', () => expect(H('```\nx = 1\n```')).toContain('x = 1')); it('language', () => expect(H('```js\nvar x;\n```')).toContain('language-js')); it('escapes html', () => expect(H('```\n\n```')).toContain('<div>')); it('no lang when none', () => expect(H('```\nplain\n```')).not.toContain('language-')); }); describe('tables', () => { const tbl = '| a | b |\n|---|---|\n| 1 | 2 |'; it('table tag', () => expect(H(tbl)).toContain('