HTML Template Linter and Formatter. Django - Jinja - Nunjucks - Handlebars - GoLang
Find a file
Anders Kaseorg beefd04471 Correctly initialize and deinitialize colorama
djlint is invoked with __name__ == "djlint" (it must be, or the
relative imports would fail), so the if __name__ == "__main__" block
does nothing.  These calls need to be made from main() itself.

The colorama_text decorator makes this easy.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-03-18 10:45:29 -07:00
.github updated issue templates 2022-02-14 11:07:31 -06:00
bin fixed path name 2022-02-18 17:02:44 -06:00
docs closes #194, added test 2022-03-14 09:24:28 -05:00
src Correctly initialize and deinitialize colorama 2022-03-18 10:45:29 -07:00
tests closes #194, added test 2022-03-14 09:24:28 -05:00
.coveragerc fixed test coverage 2021-08-17 08:56:40 -05:00
.gitignore updated release and gitignore 2022-01-03 16:50:21 -06:00
.pre-commit-config.yaml started npm installer 2022-02-18 17:01:16 -06:00
.pre-commit-hooks.yaml Make the repo a pre-commit hook. 2021-11-12 01:30:16 +00:00
icon.xcf updated docs 2022-01-03 16:45:58 -06:00
LICENSE initial commit 2021-07-12 13:26:46 -05:00
MANIFEST.in updated formatter and docs 2021-07-29 13:41:34 -05:00
package-lock.json removed unused dep 2022-02-18 17:07:00 -06:00
package.json updated version and changelog 2022-02-21 08:44:54 -06:00
poetry.lock chore(build): update packages [Weekly] 2022-02-13 01:13:38 +00:00
pyproject.toml closes #194, added test 2022-03-14 09:24:28 -05:00
README.md fixed readme 2022-01-04 08:42:12 -06:00
requirements.txt started npm installer 2022-02-18 17:01:16 -06:00
setup.cfg fixed #147, added tests 2021-11-26 13:06:05 +01:00
tox.ini updated docs 2022-01-03 16:45:58 -06:00

djLint Logo

Find common formatting issues and reformat HTML templates.

Django · Jinja · Nunjucks · Twig · Handlebars · Mustache · GoLang

Ps, --check it out on other templates as well!

codecov test Codacy Badge Maintainability Downloadschat PyPI

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:

[![Code style: djlint](https://img.shields.io/badge/html%20style-djlint-blue.svg)](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:

djLint

Contributing

Send a pr with a new feature, or checkout the issue list and help where you can.