import { createMarkdownProcessor } from '../dist/index.js'; import chai from 'chai'; describe('autolinking', () => { describe('plain md', async () => { const processor = await createMarkdownProcessor(); it('autolinks URLs starting with a protocol in plain text', async () => { const { code } = await processor.render(`See https://example.com for more.`); chai .expect(code.replace(/\n/g, '')) .to.equal(`

See https://example.com for more.

`); }); it('autolinks URLs starting with "www." in plain text', async () => { const { code } = await processor.render(`See www.example.com for more.`); chai .expect(code.trim()) .to.equal(`

See www.example.com for more.

`); }); it('does not autolink URLs in code blocks', async () => { const { code } = await processor.render( 'See `https://example.com` or `www.example.com` for more.' ); chai .expect(code.trim()) .to.equal( `

See https://example.com or ` + `www.example.com for more.

` ); }); }); });