Skip to content

[BUG] [Formatter] #1246

@fdrov

Description

@fdrov

System Info

  • OS: windows 11
  • Python Version Python 3.11.4
  • djlint, version 1.36.4
  • template language: default
  • Python clean venv with only djlint installed

Issue

When reformatting HTML using djlint test.html --reformat, extra indentation (3 spaces) is added before the href and title attributes in a multiline tag.

The same old issue #189

How To Reproduce

Create a clean Python virtual environment and install only djlint.
Activate the venv.
Run the command in Windows CMD 'djlint test.html --reformat'

Use snippet

<a class="btn btn-primary" href="{{ url("url") }}" title="{{ _("Title") }}">
<span class="iconify" data-icon="mdi:camera"></span> {{ _("Analyse your image!") }}</a>
<div class="popup beautiful-popup" id="analysis-options">
<h4>{{ _("Options") }}</h4> [...]
</div>

output:

<a class="btn btn-primary"
   href="{{ url("url") }}"
   title="{{ _("Title") }}">
    <span class="iconify" data-icon="mdi:camera"></span> {{ _("Analyse your image!") }}</a>
<div class="popup beautiful-popup" id="analysis-options">
    <h4>{{ _("Options") }}</h4>
    [...]
</div>

The href and title attributes are indented by 3 spaces instead of being aligned properly, and the inner content of the tag gets an additional indent level.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions