fix: consistent handling of markdown between post preview and preview server
This commit is contained in:
21
tests/renderer/components/EditorMarkdownPreview.test.ts
Normal file
21
tests/renderer/components/EditorMarkdownPreview.test.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { markdownToHtml } from '../../../src/renderer/components/Editor/Editor';
|
||||
|
||||
describe('Editor markdown preview rendering', () => {
|
||||
it('renders continuous blockquote lines as a single blockquote paragraph (CommonMark softbreak behavior)', () => {
|
||||
const markdown = [
|
||||
'> Georg Bauer',
|
||||
'> Am Krug 40',
|
||||
'> 48151 Münster',
|
||||
'> eMail: gb at rfc1437.de',
|
||||
].join('\n');
|
||||
|
||||
const html = markdownToHtml(markdown, 'post-1');
|
||||
|
||||
expect((html.match(/<blockquote>/g) ?? []).length).toBe(1);
|
||||
expect((html.match(/<p>/g) ?? []).length).toBe(1);
|
||||
expect(html).not.toContain('<br');
|
||||
expect(html).toContain('Georg Bauer');
|
||||
expect(html).toContain('eMail: gb at rfc1437.de');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user