Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Concerns/RendersBladeGuidelines.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ protected function renderContent(string $content, string $path, array $data = []
...$data,
]);

$rendered = html_entity_decode($rendered, ENT_QUOTES | ENT_HTML5);

return str_replace(array_values($placeholders), array_keys($placeholders), $rendered);
}

Expand Down
24 changes: 24 additions & 0 deletions tests/Unit/Concerns/RendersBladeGuidelinesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,30 @@ public function getStoredSnippets(): array
->toContain('@endvolt');
});

test('html entities from blade expressions are decoded back to plain text for markdown output', function (): void {
$this->mock(GuidelineAssist::class);

$content = 'Run {{ "tinker --execute \"your code here\"" }}';

$result = $this->renderer->render($content, '/path/to/guide.blade.php');

expect($result)->toContain('tinker --execute "your code here"')
->not->toContain('"');
});

test('all common html entities are decoded', function (): void {
$this->mock(GuidelineAssist::class);

$content = 'Use {{ "a < b & c > d" }}';

$result = $this->renderer->render($content, '/path/to/guide.blade.php');

expect($result)->toContain('a < b & c > d')
->not->toContain('&lt;')
->not->toContain('&amp;')
->not->toContain('&gt;');
});

test('renderBladeFile returns empty string for non-existent file', function (): void {
$result = $this->renderer->renderFile('/non/existent/guideline.blade.php');

Expand Down
Loading