djLint icon indicating copy to clipboard operation
djLint copied to clipboard

[FEATURE]Is it possible to add a function to fix H017 automatically?

Open Taikono-Himazin opened this issue 3 years ago • 3 comments

  • [x] I've searched the issues
  • [x] I've read the docs

Feature Request

Djlint outputs H017 for the following code. Tag should be self closing. (H017)

<img src="{% static 'img/item02.png' %}">

I want this to be automatically corrected as follows.

<img src="{% static 'img/item02.png' %}" />

H017 happens frequently and I think it's okay to fix it automatically. Will djlint provide the ability to fix this automatically?

Taikono-Himazin avatar May 27 '22 02:05 Taikono-Himazin

Its definitely a nice idea.. fix linter errors vs reformatting the entire file 👍🏽

christopherpickering avatar May 31 '22 11:05 christopherpickering

Hi @christopherpickering :)

Wanted to bring https://github.com/mdn/content/pull/17138 to your attention in relation to this feature request. The original PR was based on H017 from djlint, with the consensus being that this is an XHTML convention that is incorrectly being applied to HTML5.

Result was this pattern being removed from the remaining instances in the Mozilla Developer Network learning area in https://github.com/mdn/django-locallibrary-tutorial/pull/106 and https://github.com/mdn/content/pull/17149.

andrewtavis avatar Jun 13 '22 08:06 andrewtavis

Thanks for pointing that out. I agree its not needed, It's a matter of personal preference in the end. Thanks!

christopherpickering avatar Jun 13 '22 11:06 christopherpickering

Also see https://github.com/Riverside-Healthcare/djLint/issues/372

christopherpickering avatar May 08 '23 20:05 christopherpickering

Sorry for the delay, this should be in the next release.

christopherpickering avatar May 08 '23 20:05 christopherpickering

:tada: This issue has been resolved in version 1.26.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

christopherpickering avatar May 08 '23 22:05 christopherpickering

thank you! I haven't tried it yet, but I'm sure it will be very easy to use. I hope djlint keeps getting better and better.

Taikono-Himazin avatar May 09 '23 08:05 Taikono-Himazin