Pycharm, stop on code refactoring spliting html tags attributes

I use Pycharm for Python and HTML development.

How do I set Pycharm no to split html tags(keep them on a single line), when I use Reformat code in html files that are used as templates(have both python and html inside)

Example:

<a class="lambda-content"
                               href="{{ item.datacolect_obj.document.url }}"> {{ item.datacolect_obj.filename }}</a>

If there are multiple tags, is ok to split.

I checked, Code style -> HTML, Don't break if inline content, added a, no luck;

if the content, only content is too long, can be split for paragraphs, but not the tag itself.

5 comments

In Settings | Editor | Code Style | HTML, set Wrap attributes to Do not wrap - does it help?

0

no is not working, if I have an image is doing:

 

 <img src="
                {% if image_t%}{{ image_t.url }}{% else %}{% static 'img/placeholders/image.png' %}{% endif %}" />

0

Works for me. Please provide a sample project that shows up the issue plus your settings (File | Export settings)

0

Is working in pure HTML, or in Django Template HTML ?

As example, the codes above:

<a class="lambda-content" href="{{ item.datacolect_obj.document.url }}"> {{ item.datacolect_obj.filename }}</a>
 <img src="{% if image_t%}{{ image_t.url }}{% else %}{% static 'img/placeholders/image.png' %}{% endif %}" />

Go to: Code->Reformat code

Below my settings:

0

Please sign in to leave a comment.