djlint
HTML template linter and formatter (Django, Jinja, Twig, Nunjucks, Handlebars, Liquid, Go templates)
What it is and what it does
djlint is a command-line formatter and linter designed to fill a gap: while every programming language has formatters and linters, HTML templates are typically left unformatted because generic HTML tools cannot parse template syntax like `{% %}` and `{{ }}`. djlint reads both HTML and template syntax together, with built-in profiles for Django, Jinja, Twig, Nunjucks, Handlebars, Liquid, Go templates, and others.
It reformats templates by fixing indentation, normalizing tag case, splitting long tags into one attribute per line, and collapsing stray blank lines. Its linter catches structural issues that formatting alone cannot fix: orphan tags, missing alt attributes, hard-coded URLs, and dozens of other template-specific checks. The tool is available as a CLI, integrates with pre-commit, and has editor plugins for VS Code and other environments.
Use it for:
- Enforce consistent indentation and formatting across Django or Jinja templates in a web project.
- Catch missing alt attributes, unclosed tags, and other accessibility or structural issues in templates during code review.
- Reformat a large legacy template codebase to a standard style in one pass.
- Integrate template linting into CI/CD pipelines via pre-commit hooks to prevent formatting drift.
- Validate template syntax for multiple template engines (Twig, Nunjucks, Handlebars) in a polyglot project.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
djlint formats and lints HTML templates with embedded template syntax (Django, Jinja, Twig, Nunjucks, Handlebars, Liquid, Go templates, and others), fixing indentation, tag case, spacing, and catching structural issues that generic HTML tools miss.
Yes. djlint is actively maintained, has no known vulnerabilities, low install friction, and solves a real problem—template formatting and linting that generic HTML tools cannot handle. The GPL-3.0-or-later license is copyleft, so verify compatibility with your project's license before bundling; development and CI/CD use are unaffected. Recommended for any project using Django, Jinja, or other templated HTML.
Install
djlint on PyPI
pip
pip install djlintuv
uv add djlintpoetry
poetry add djlintInstalling djlint
Before you install
Low friction: pure Python wheel with 9 runtime dependencies (click, cssbeautifier, jsbeautifier, json5, pathspec, pyyaml, regex, tomli, typing-extensions). Active maintenance—last release 6 days ago, repository updated 2026-08-14, 944 stars.
License in practice
GPL-3.0-or-later (copyleft): you may use djlint freely, but any derivative work or distribution must also be GPL-3.0-or-later. Acceptable for development and CI/CD; review your project's license compatibility before bundling.
Quickstart
pip install djlint
djlint . --reformat --single-attribute-per-line --profile=django
djlint . --lint
Requires Python 3.10 or later.
Verify before relying
- Performance characteristics on large template codebases or real-world project sizes.
- Completeness of linting rules for each template engine profile (Django, Jinja, Twig, etc.).
- Whether the tool integrates with popular CI/CD platforms beyond pre-commit.
Package facts
| License | GPL-3.0-or-later (copyleft) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 9 — click, cssbeautifier, jsbeautifier, json5, pathspec, pyyaml, regex, tomli, typing-extensions |
| Maintenance | actively maintained — 6 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,623,732/month — #2,553 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: djlint-1.44.2-py3-none-any.whl
Keywords: askama, django, formatter, go templates, handlebars, helm, html, hugo, jinja, jinja2, linter, liquid, mustache, nunjucks, templates, tera, twig
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
curlylintLints HTML templates in Jinja, Nunjucks,…
permissive · top 15,000 on PyPI
djadeDjade is a command-line formatter for Django…
permissive · top 15,000 on PyPI
djhtmlDjHTML indents Django and Jinja template files…
copyleft · top 15,000 on PyPI
tclinttclint is a CLI linter, formatter, and language…
permissive · top 15,000 on PyPI
j2lintj2lint validates Jinja2 template syntax and…
permissive · top 15,000 on PyPI
mbakembake formats and lints Makefiles, enforcing…
permissive · top 15,000 on PyPI
PlimPlim translates a concise Ruby-inspired…
permissive · top 15,000 on PyPI
python-liquidPython Liquid is a template engine that renders…
permissive · top 5,000 on PyPI
liquidpyLiquidpy is a Python port of the Liquid…
permissive · top 15,000 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI