1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-07 23:03:00 +03:00

Improved iframe & summary handling in HTML to MD conversion

This commit is contained in:
Dan Brown
2022-04-29 14:58:28 +01:00
parent c8a7acb6c7
commit 26af9acc6c
4 changed files with 41 additions and 1 deletions

View File

@@ -47,6 +47,22 @@ class MarkdownToHtmlTest extends TestCase
);
}
public function test_summary_tags_have_newlines_after_to_separate_content()
{
$this->assertConversion(
'<details><summary>Toggle</summary><p>Test</p></details>',
"<details><summary>Toggle</summary>\n\nTest\n\n</details>"
);
}
public function test_iframes_tags_have_newlines_after_to_separate_content()
{
$this->assertConversion(
'<iframe src="https://example.com"></iframe><p>Beans</p>',
"<iframe src=\"https://example.com\"></iframe>\n\nBeans"
);
}
protected function assertConversion(string $html, string $expectedMarkdown, bool $partialMdMatch = false)
{
$markdown = (new HtmlToMarkdown($html))->convert();