fix: separate block elements from the inline content before them

An image or link right before a heading or paragraph ended up on the
same line, e.g. `![](a.png)### A`.

Fixes #259
This commit is contained in:
dualfroz committed 2026-10-02 16:19:40 +02:00
1 parent 6b7a074e8d
commit 1bb05d0606
2 files changed
+29 -3

No files matched your search

+4
View File
@@ -134,6 +134,10 @@ class HtmlConverterTest extends TestCase
public function testImage(): void
{
$this->assertHtmlGivesMarkdown('<img src="/path/img.jpg" alt="alt text" title="Title" />', '![alt text](/path/img.jpg "Title")');
$this->assertHtmlGivesMarkdown("<img src=\"a.png\" />\n<h3>A new header</h3>", "![](a.png)\n\n### A new header");
$this->assertHtmlGivesMarkdown('<img src="a.png" /><p>Paragraph</p>', "![](a.png)\n\nParagraph");
$this->assertHtmlGivesMarkdown('<a href="b.html"><img src="a.png" /></a><h3>A new header</h3>', "[![](a.png)](b.html)\n\n### A new header");
$this->assertHtmlGivesMarkdown('<blockquote><img src="a.png" /><p>Paragraph</p></blockquote>', "> ![](a.png)\n> \n> Paragraph");
}
public function testAnchor(): void