Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Volt is rendering HTML in a single line

Hi, I'm trying change this in my development enviroment but can't find where do it. I downloaded same samples and in this projects (INVO,Vokuro, Yona and others) all html output are normal with breaklines but in my self project the output are in a single line and to debug Javascript is very hard. Anyone know how change this, this is a volt or phalcon setting? Thanks for attention.



356
Accepted
answer
edited Nov '17

Ops, i found the solution, my index.php in public folder had this line: echo str_replace(["\n","\r","\t"], '', $application->handle()->getContent());

sorry for inconvenient

Hi @mauro other simple way using {{- -}} and {%- -%}

{%- if categories is defined -%}
    {{- "<h1>Categories</h1>" -}}
    {{- "<ul>" -}}
    {%- for category in categories -%}
        <li>
        {{- '<span class="label label-default pull-right">' ~ category.number_posts ~ '</span>' ~ category.name -}}
        </li>
    {%- endfor -%}
    {{- "</ul>" -}}
{%- endif -%}

output

<h1>Categories</h1><ul><li>cat1</li><li>cat2></li></ul>

I hope it's help you. Good luck