djLint is a formatter and linter designed specifically for HTML templates. Generic HTML tools often struggle when markup is mixed with template constructs, while template engines themselves generally do not enforce consistent HTML formatting.
djLint handles both layers together, making it useful for projects built with Django templates, Jinja, Twig, Nunjucks, Handlebars, Liquid and several other templating systems. It can be used directly from the command line, incorporated into automated development workflows, or connected to supported editors. Profiles tailor parsing and formatting behaviour to particular template languages, allowing one tool to cover projects that mix conventional HTML with server-side or static-site templating syntax.
This is free and open source software.
Key Features
- Reformats indentation, element case, whitespace and attribute layout while preserving embedded template constructs.
- Checks markup for structural problems including orphaned and incorrectly closed tags.
- Detects accessibility issues such as images without appropriate alternative text.
- Provides checks for hard-coded URLs and numerous other correctness and style problems.
- Supports Django, Jinja, Twig, Nunjucks, Handlebars, Liquid, Go templates, Angular, Mustache, Tera and Askama.
- Offers language-specific profiles that adjust formatting and linting behaviour for individual template engines.
- Can check whether files conform to the expected formatting without modifying them.
- Integrates with pre-commit for automatic formatting and lint checks before changes are committed.
- Provides configuration options for selecting, ignoring and customising individual linting rules.
- Offers integrations for editors and development environments including VS Code, Neovim and Sublime Text.
Website: github.com/djlint/djLint
Support:
Developer: Christopher Pickering and contributors
License: GNU General Public License v3.0
djLint is written in Python. Learn Python with our recommended free books and free tutorials.
Related Software
| HTML Linters | |
|---|---|
| HTMLHint | Static code analysis tool |
| v.Nu | Catch mistakes in HTML, CSS and SVG |
| markuplint | HTML linter for markup developers |
| LintHTML | HTML5 linter and validator |
| HTML-validate | Offline HTML5 validator |
| jinjalint | Prototype linter |
| HTML ESLint | ESLint plugin for linting HTML files |
Read our verdict in the software roundup.
Explore our carefully curated directory of recommended free and open source software, covering every major software category.The directory forms part of our extensive collection of articles for Linux enthusiasts. It includes hundreds of detailed reviews, together with free and open source alternatives to proprietary software from companies such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. LinuxLinks also covers interesting projects worth exploring, Linux-compatible hardware, free programming books and tutorials, and much more. Know a useful free and open source Linux application that we haven’t covered? Tell us about it using our submission form. |


Please read our Comment Policy before commenting.