djhtml
Django/Jinja template indenter
Decision gist · record as of 2026-08-14
Yes. DjHTML is actively maintained, has no runtime dependencies, installs easily, and solves a specific problem well—indenting Django/Jinja templates without reformatting content. The GPLv3+ license is a consideration for proprietary projects, but the tool is ideal for open-source Django/Jinja workflows, especially when integrated with pre-commit. No known security vulnerabilities.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Windows users should set the environment variable PYTHONUTF8 to 1 to ensure proper UTF-8 handling.
- Installation is straightforward with no runtime dependencies.
- The package is actively maintained with recent releases and a stable repository.
License · maintenance · safety
GPLv3+ (copyleft) — Licensed under GPLv3+, a copyleft license. Any derivative work or distribution must also be open-source under compatible terms; proprietary projects cannot incorporate this package without releasing their modifications.
last release 2026-03-26 (141 days) · last repo commit 2026-04-17 · 643 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 507,180 downloads/mo, #6,283 on PyPI
Alternatives
Verify before relying
$ pip install djhtml
$ djhtml template.html
# Or use as a pre-commit hook by adding to .pre-commit-config.yaml:
# - repo: https://github.com/rtts/djhtml
# hooks:
# - id: djhtml- Whether the package correctly handles all edge cases in nested Django/Jinja template structures.
- Performance characteristics on very large template files or directories with thousands of files.
What it is and what it does
DjHTML is a pure-Python indentation tool designed specifically for Django and Jinja templates that mix HTML, CSS, and JavaScript. Unlike general formatters, it operates as an indenter—it adjusts only leading whitespace on each line without inserting newlines, removing content, or restructuring code. This makes it suitable for fixing indentation in already well-structured templates while leaving the template logic and content untouched.
The tool works as a command-line utility and integrates cleanly with pre-commit hooks for automated indentation on every commit. It supports three modes (DjHTML, DjCSS, and DjJS) that activate automatically when encountering style or script tags, and allows fine-grained control via command-line options like custom tab width and extra block tag definitions. It also respects fmt:off/fmt:on markers and ignores content inside comments and special template tags.
Use it for
- Automatically indent all Django templates in a project before each commit using pre-commit hooks.
- Fix indentation inconsistencies in Jinja templates across a codebase without altering template logic.
- Maintain consistent whitespace in mixed HTML/CSS/JavaScript template files during development.
- Dry-run indentation checks on templates using the --check flag to verify formatting without modifying files.
- Define custom block tags for non-standard template syntax and apply consistent indentation rules.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
DjHTML is actively maintained, has no runtime dependencies, installs easily, and solves a specific problem well—indenting Django/Jinja templates without reformatting content. The GPLv3+ license is a consideration for proprietary projects, but the tool is ideal for open-source Django/Jinja workflows, especially when integrated with pre-commit. No known security vulnerabilities.
Install
djhtml on PyPI
Before you install
Installation is straightforward with no runtime dependencies. The package is actively maintained with recent releases and a stable repository. Requires Python 3.9 or higher.
Windows users should set the environment variable PYTHONUTF8 to 1 to ensure proper UTF-8 handling.
License in practice
Licensed under GPLv3+, a copyleft license. Any derivative work or distribution must also be open-source under compatible terms; proprietary projects cannot incorporate this package without releasing their modifications.
Quickstart
$ pip install djhtml
$ djhtml template.html
# Or use as a pre-commit hook by adding to .pre-commit-config.yaml:
# - repo: https://github.com/rtts/djhtml
# hooks:
# - id: djhtml
Verify before relying
- Whether the package correctly handles all edge cases in nested Django/Jinja template structures.
- Performance characteristics on very large template files or directories with thousands of files.
Package facts
| License | GPLv3+ copyleft |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 141 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 507,180 / month, #6,283 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)Operating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9 |
Evidence: djhtml-3.0.11-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “django template indenter”
- djhtmlDjHTML indents Django and Jinja template files containing mixed HTML,…
- djadeDjade is a command-line formatter for Django template syntax, built…
- django-template-partialsProvides reusable named template partials for Django's template…
Give your agent the search over MCP, or paste the wish link into any chat.
More HTML packages
MarkupSafe provides a text object that escapes special characters so untrusted strings can be safely embedded in HTML and XML without injection attacks.
Jinja2 is a templating engine that renders dynamic content by combining templates with Python-like syntax and data, supporting template inheritance, macros, autoescaping, and sandboxed execution.
Beautiful Soup parses HTML and XML documents into a navigable tree, providing Pythonic methods to search, iterate, and modify the parsed content.
Install it if you need to parse or extract data from markup documents.
lxml provides Python bindings to libxml2 and libxslt, enabling parsing, validation, and transformation of XML and HTML documents through an ElementTree-compatible API with support for XPath, XSLT, and schema validation.
Install it if you need robust XML/HTML parsing, validation, or transformation; avoid it only if you must stay pure-Python and can accept slower performance.
Docutils converts plaintext documentation in reStructuredText format into multiple output formats including HTML, XML, and LaTeX using a modular processing system.
Converts Markdown text to HTML using a Python implementation of John Gruber's Markdown specification, with support for extensions.
Install it if you need to parse Markdown in Python.
See also djlint · djade · django-settings-export · curlylint · jinja_partials · j2lint · sphinx-jinja · xmlformatter · reformat-gherkin