djlint / djLint

✨ HTML Template Linter and Formatter. Django - Jinja - Nunjucks - Handlebars - GoLang
https://djLint.com
GNU General Public License v3.0
686 stars 84 forks source link

[BUG] [Formatter] Formatting changes depending on type of quotes used #777

Open knyghty opened 11 months ago

knyghty commented 11 months ago

System Info

Issue

With double quotes in tags, the formatter likes to put everything on one line. With single quotes, it likes to split them up more.

How To Reproduce

<img class="h-6 w-6" src="{% static 'images/warning-icon-white.svg' %}" alt="">

is reformatted to:

<img class="h-6 w-6"
     src="{% static 'images/warning-icon-white.svg' %}"
     alt="">

However:

<img class="h-6 w-6" src="{% static "images/warning-icon-white.svg" %}" alt="">

stays the same. If I attempt to format it myself, the formatter will put it on a single line, no matter how long the line is or what max_line_length is set to.