I couldn't find a proper one online, but https://ctrlq.org/beautifier/ solves the problem.

It considers the PHP part as text, not counting in the indentation, which has the result of outputting HTML with the proper indentation, not one tab further as it would if it considered the Laravel @foreach and {{echos}} (etc) as code, not text.

Sublime

For Sublime, you could use Laravel Blade Highlighter, fount at: https://packagecontrol.io/packages/Laravel%20Blade%20Highlighter

Atom

As for Atom, there's the atom-beautify package, but I had never luck getting it to work without errors (even with it's 6 million downloads, might just be bad luck).

As I use Atom, I have to stick to manual indenting, or the beautifier above linked. Any suggestions are welcome!

Photo by Element5 Digital on Unsplash


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

en_USEnglish