Lintez et formatez vos templates HTML
Les outils HTML génériques ne savent pas analyser {% %} ni {{ }}, et les moteurs de templates ne se soucient pas de l'allure du balisage qui les entoure. djLint reformate le HTML chargé de syntaxe de template et y détecte les erreurs courantes, avec des profils pour Django, Jinja, Twig, Nunjucks, Handlebars, Liquid, les templates Go et d'autres encore. Il s'utilise en ligne de commande, comme hook pre-commit et comme serveur de langage dans votre éditeur.
uv tool install djlintpip install djlintnpm i -g djlint{% block content %}<SECTION H009 Tag names should be lowercase. class='posts' H008 Attributes should be double quoted.> H014 Found extra blank lines.<h2>Latest posts</h2>{%if posts%} T001 Variables should be wrapped in a whitespace.<ul>{% for post in posts %}<li><a href="{% url 'post' post.slug %}" class='post-link' H008 Attributes should be double quoted. aria-label="Read {{post.title}}" T001 Variables should be wrapped in a whitespace.>{{post.title}} T001 Variables should be wrapped in a whitespace.</a></li>{% endfor %}</ul>{%else%} T001 Variables should be wrapped in a whitespace.<p>No posts yet.</p>{%endif%} T001 Variables should be wrapped in a whitespace.</SECTION H009 Tag names should be lowercase.>{% endblock %}{% block content %} <section class="posts"> <h2>Latest posts</h2> {% if posts %} <ul> {% for post in posts %} <li> <a href="{% url 'post' post.slug %}" class="post-link" aria-label="Read {{ post.title }}">{{ post.title }}</a> </li> {% endfor %} </ul> {% else %} <p>No posts yet.</p> {% endif %} </section>{% endblock %}{% block content %} <section class="posts"> <h2>Latest posts</h2> {% if posts %} <ul> {% for post in posts %} <li> <a href="{% url 'post' post.slug %}" class="post-link" aria-label="Read {{ post.title }}" >{{ post.title }}</a> </li> {% endfor %} </ul> {% else %} <p>No posts yet.</p> {% endif %} </section>{% endblock %}Un profil pour votre langage de templates
Badge
Voici le rendu :
Ajoutez un badge à vos projets:
[](https://djlint.com).. image:: https://img.shields.io/badge/html%20style-djLint-blue.svg :target: https://djlint.comContribuer
Les contributions sont les bienvenues. Choisissez une issue sur laquelle travailler, ou ouvrez une pull request avec un correctif ou une nouvelle fonctionnalité.
GitHubdjLint a été créé par Christopher Pickering pour les projets Atlas. Il est aujourd'hui maintenu par monosans et toutes les personnes qui y contribuent.