Проверка и форматирование HTML-шаблонов
Универсальные инструменты для HTML не умеют разбирать {% %} и {{ }}, а шаблонизаторам безразлично, как выглядит разметка вокруг них. djLint форматирует HTML, насыщенный шаблонным синтаксисом, и проверяет его на типичные ошибки. Есть профили для Django, Jinja, Twig, Nunjucks, Handlebars, Liquid, шаблонов Go и других. Он работает из командной строки, как хук pre-commit и как языковой сервер в редакторе.
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 %}Профиль для вашего языка шаблонов
Значок
Выглядит так:
Добавьте значок в свои проекты:
[](https://djlint.com).. image:: https://img.shields.io/badge/html%20style-djLint-blue.svg :target: https://djlint.comУчастие в разработке
Мы рады вашему участию. Выберите задачу, над которой хотите поработать, или откройте пул-реквест с исправлением или новой возможностью.
GitHubdjLint создал Christopher Pickering для проектов Atlas. Сейчас его поддерживают monosans и все, кто вносит вклад.