diff --git a/src/Renderer/Block/HtmlBlockRenderer.php b/src/Renderer/Block/HtmlBlockRenderer.php index 1d1d99c..e5d2b01 100644 --- a/src/Renderer/Block/HtmlBlockRenderer.php +++ b/src/Renderer/Block/HtmlBlockRenderer.php @@ -28,6 +28,8 @@ public function render(Node $node, ChildNodeRendererInterface $childRenderer): s { HtmlBlock::assertInstanceOf($node); + // We ignore $node->getType() here, as we want to render all HTML blocks the same way. + $htmlInput = $this->config->get('html_input'); return HtmlFilter::filter($node->getLiteral(), $htmlInput); diff --git a/tests/Renderer/Block/HtmlBlockRendererTest.php b/tests/Renderer/Block/HtmlBlockRendererTest.php index 0f44eb8..087a1e7 100644 --- a/tests/Renderer/Block/HtmlBlockRendererTest.php +++ b/tests/Renderer/Block/HtmlBlockRendererTest.php @@ -37,6 +37,28 @@ public function it_renders_paragraph(): void $this->assertEquals('', $result); } + #[Test] + public function it_renders_cdata_html(): void + { + $block = new HtmlBlock(HtmlBlock::TYPE_5_CDATA); + $block->setLiteral(<<Hello World + ]]> + HTML); + $fakeRenderer = new FakeChildNodeRenderer(); + $fakeRenderer->pretendChildrenExist(); + + $result = $this->renderer->render($block, $fakeRenderer); + + $this->assertIsString($result); + $this->assertEquals(<<Hello World + ]]> + HTML, $result); + } + /** * @param array $values */