I've a pretty complicated blade layout, it's not strictly HTML as I'm using it to construct code for mermaid diagrams (https://mermaid-js.github.io/).
The code is generating fine, but when I render the blade template to a string it outputs with escaped characters and line breaks eg:
$code = view('holiday.diagram')->render();
OUTPUT:
graph TD\npeople[\"<strong>PEOPLE<\/strong>\n<hr \/> <strong>PERSON FIRST NAME<\/strong>: FOO BAR <br \/><strong>Number of TRAVELLERS<\/strong>: 6<br \/>
How can I remove these escaped chars and display the code as is? I've tried htmlspecialchars-decode()
but it does not remove them.
If you want it to be html, use method toHtml()
view('holiday.diagram')->toHtml();