assertConversion( '

Dogcat

Some bold text

', "# Dogcat\n\nSome **bold** text" ); } public function test_callouts_remain_html() { $this->assertConversion( '

Dogcat

Some callout text

Another line

', "# Dogcat\n\n

Some callout text

\n\nAnother line" ); } public function test_wysiwyg_code_format_handled_cleanly() { $this->assertConversion( '

Dogcat

' . "\r\n" . '
var a = \'cat\';

Another line

', "# Dogcat\n\n```JavaScript\nvar a = 'cat';\n```\n\nAnother line" ); } public function test_tasklist_checkboxes_are_handled() { $this->assertConversion( '', "- [x] Item A\n- [ ] Item B" ); } public function test_drawing_blocks_remain_html() { $this->assertConversion( '
Some text', '
' . "\n\nSome text" ); } public function test_summary_tags_have_newlines_after_to_separate_content() { $this->assertConversion( '
Toggle

Test

', "
Toggle\n\nTest\n\n
" ); } public function test_iframes_tags_have_newlines_after_to_separate_content() { $this->assertConversion( '

Beans

', "\n\nBeans" ); } protected function assertConversion(string $html, string $expectedMarkdown, bool $partialMdMatch = false) { $markdown = (new HtmlToMarkdown($html))->convert(); if ($partialMdMatch) { static::assertStringContainsString($expectedMarkdown, $markdown); } else { static::assertEquals($expectedMarkdown, $markdown); } } }