1

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.

1 Answer 1

1

If you want it to be html, use method toHtml()

view('holiday.diagram')->toHtml();
Sign up to request clarification or add additional context in comments.

2 Comments

This removes the html attributes unfortunately.
This answer may help you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.