feat: add md<->html document converters

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-31 08:31:00 +02:00
co-authored by Claude Sonnet 5
parent 28b6edac82
commit 1595c5e0af
2 changed files with 43 additions and 1 deletions
+26
View File
@@ -74,4 +74,30 @@ describe('document converters', () => {
const detected = await detectInputMime(outputPath);
expect(detected.mime).toBe('application/pdf');
}, 20000);
it('converts MD to HTML', async () => {
const inputPath = path.join(tmpDir, 'fixture.md');
await fs.writeFile(inputPath, '# Heading\n\nSome **bold** text.');
const outputPath = path.join(tmpDir, 'from-md.html');
const entry = resolve('md', 'html');
await entry.convert(inputPath, outputPath);
const html = await fs.readFile(outputPath, 'utf8');
expect(html).toContain('<h1>Heading</h1>');
expect(html).toContain('<strong>bold</strong>');
});
it('converts HTML to MD', async () => {
const inputPath = path.join(tmpDir, 'fixture-for-md.html');
await fs.writeFile(inputPath, '<h1>Heading</h1><p>Some <strong>bold</strong> text.</p>');
const outputPath = path.join(tmpDir, 'from-html.md');
const entry = resolve('html', 'md');
await entry.convert(inputPath, outputPath);
const markdown = await fs.readFile(outputPath, 'utf8');
expect(markdown).toContain('# Heading');
expect(markdown).toContain('**bold**');
});
});