mirror of
https://github.com/Hopiu/djLint.git
synced 2026-05-22 11:51:52 +00:00
✨ HTML Template Linter and Formatter. Django - Jinja - Nunjucks - Handlebars - GoLang
This patch adds a configuration option for requiring files to have a pragma comment at the beginning of the file in order to reformat the file. This behaviour is useful for a slow adoption of the tool instead of requiring the whole codebase to be converted at once. The patch also contains tests for the different kinds of supported pragma comments, based on the profile defined for the project. |
||
|---|---|---|
| .github | ||
| docs | ||
| src | ||
| tests | ||
| .coveragerc | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| LICENSE | ||
| MANIFEST.in | ||
| poetry.lock | ||
| pyproject.toml | ||
| README.md | ||
| setup.cfg | ||
| tox.ini | ||
Find common formatting issues and reformat HTML templates.
Django · Jinja · Nunjucks · Handlebars · Mustache · GoLang
Ps, --check it out on other templates as well!
Documentation
Read the documentation
Installation and Usage
djLint can be installed with pip install djlint, and is easy to run:
# to lint a directory
djlint /path
# to lint a directory with custom extension
djlint /path -e html.dj
# to check formatting on a file
djlint /path/file.html.j2 --check
# to reformt a directory without printing the file diff
djlint /path --reformat --quiet
# using stdin
echo "<div></div>" | djlint -
Show your format
Add a badge to your projects readme.md:
[](https://github.com/Riverside-Healthcare/djlint)
Add a badge to your readme.rst:
.. image:: https://img.shields.io/badge/html%20style-djlint-blue.svg
:target: https://github.com/Riverside-Healthcare/djlint
Looks like this:
Contributing
Send a pr with a new feature, or checkout the issue list and help where you can.