normalizer = new RichTextMarkdownNormalizer; }); it('returns null and empty values untouched', function () { expect($this->normalizer->normalize(null))->toBeNull(); expect($this->normalizer->normalize(''))->toBe(''); expect($this->normalizer->normalize(' '))->toBe(' '); }); it('converts heading markdown wrapped in paragraph tags', function () { $html = '
# EINUNDZWANZIG STANDUP
## Wer ich bin
Regular text.
'; $result = $this->normalizer->normalize($html); expect($result)->toContain('- first item
- second item
- third item
'; $result = $this->normalizer->normalize($html); expect($result)->toContain('# not a heading
'; expect($this->normalizer->normalize($html))->toBe($html); }); it('leaves structural html untouched when list tags already exist', function () { $html = '- not a list
'; expect($this->normalizer->normalize($html))->toBe($html); }); it('leaves plain paragraph html untouched when it is not markdown', function () { $html = 'Just some normal text without any markdown syntax.
'; expect($this->normalizer->normalize($html))->toBe($html); }); it('renders pure plain text with paragraph breaks as html paragraphs', function () { $text = "First paragraph with some text.\n\nSecond paragraph follows."; $result = $this->normalizer->normalize($text); expect($result)->toContain('First paragraph with some text.
'); expect($result)->toContain('Second paragraph follows.
'); }); it('renders plain text markdown (headings, lists, images) as html', function () { $text = "## Heading Two\n\nSome intro line.\n\n- first\n- second\n\n"; $result = $this->normalizer->normalize($text); expect($result)->toContain('Antragsteller: DrShift — user@example.com
# Heading
'; $result = $this->normalizer->normalize($html); expect($result)->toContain('user@example.com');
expect($result)->toContain('Website');
});
it('preserves images embedded via img tags', function () {
$html = '# Heading
