import {convertHtmlToMarkdown} from './html2markdown.ts'; import {createElementFromHTML} from '../utils/dom.ts'; const h = createElementFromHTML; test('convertHtmlToMarkdown', () => { expect(convertHtmlToMarkdown(h(`

h

`))).toBe('# h'); expect(convertHtmlToMarkdown(h(`txt`))).toBe('**txt**'); expect(convertHtmlToMarkdown(h(`txt`))).toBe('_txt_'); expect(convertHtmlToMarkdown(h(`txt`))).toBe('~~txt~~'); expect(convertHtmlToMarkdown(h(`txt`))).toBe('[txt](link)'); expect(convertHtmlToMarkdown(h(`https://link`))).toBe('https://link'); expect(convertHtmlToMarkdown(h(``))).toBe('![image](link)'); expect(convertHtmlToMarkdown(h(`name`))).toBe('![name](link)'); expect(convertHtmlToMarkdown(h(``))).toBe('image'); expect(convertHtmlToMarkdown(h(`

txt

`))).toBe('txt\n'); expect(convertHtmlToMarkdown(h(`
a\nb
`))).toBe('> a\n> b\n'); expect(convertHtmlToMarkdown(h(`
  1. a
`))).toBe('1. a\n * b\n\n'); expect(convertHtmlToMarkdown(h(`
  1. a
`))).toBe('1. [x] a\n'); });