Skip to main content

A fast HTML template linter and formatter, ported from djlint to Rust.

Project description

djlintr

A fast HTML template linter and formatter. Port of djlint to Rust.

Currently only supports HTML and Django templates; Jinja2 and Nunjucks to be added in the future.

Installation

You can install djlintr directly from PyPI using pip or uv:

pip install djlintr
# or
uv pip install djlintr

Alternatively, you can grab one of the binary release files from GitHub.

Or, to install djlintr from source, ensure you have Rust installed and run:

cargo install --path .

Usage

djlintr [OPTIONS] <PATHS>...

Arguments

  • <PATHS>...: Files or directories to process.

Options

  • -r, --reformat: Reformat files.
  • -l, --lint: Lint files.
  • -e, --extension <EXTENSION>: File extensions to include (default: html).
  • -t, --threads <THREADS>: Number of threads to use.
  • --check: Return non-zero exit code if issues are found.
  • --max-attribute-length <MAX_ATTRIBUTE_LENGTH>: Maximum length for attributes before wrapping (default: 70).
  • --custom-blocks <CUSTOM_BLOCKS>: Comma-separated list of custom block tags.
  • -h, --help: Print help.
  • -V, --version: Print version.

Configuration

djlintr automatically searches for a .djlintrc (JSON) file or a pyproject.toml file in the current directory.

Supported Options

  • indent: Number of spaces for indentation (default: 4).
  • max_line_length: Maximum line length (default: 120).
  • max_attribute_length: Maximum length for attributes before wrapping (default: 70).
  • ignore: A list of rule codes to ignore.
  • custom_blocks: A list of custom block tags.

Python Compatibility Flags

djlintr aims for byte-for-byte parity with the original Python djlint. In a couple of places djlintr has a "better" implementation than the Python original, but defaults to reproducing the Python behaviour so that existing projects get identical output. These flags let you opt in to the improved (but intentionally non-identical) behaviour:

  • better_attribute_parsing (default: false): When false, djlintr uses the same attribute-matching regex as Python djlint, quirks and all. Set to true to use djlintr's cleaner attribute-parsing regex, which handles some edge cases more correctly but may produce output that differs from Python djlint.
  • require_closed_blocks (default: false): When false, djlintr indents the contents of a recognized block tag even when no explicit closing tag is present, matching Python djlint's lenient behaviour. Set to true to only indent blocks that have an explicit closing tag.

Example .djlintrc

{
  "indent": 2,
  "max_line_length": 100,
  "ignore": ["H006", "T001"]
}

Example pyproject.toml

djlintr supports both [tool.djlint] and [tool.djlintr] sections.

[tool.djlintr]
indent = 2
max_line_length = 100
ignore = ["H006", "T001"]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djlintr-0.6.3.tar.gz (115.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

djlintr-0.6.3-py3-none-win_amd64.whl (1.3 MB view details)

Uploaded Python 3Windows x86-64

djlintr-0.6.3-py3-none-manylinux_2_34_x86_64.whl (1.5 MB view details)

Uploaded Python 3manylinux: glibc 2.34+ x86-64

djlintr-0.6.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

djlintr-0.6.3-py3-none-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

djlintr-0.6.3-py3-none-macosx_10_12_x86_64.whl (1.4 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file djlintr-0.6.3.tar.gz.

File metadata

  • Download URL: djlintr-0.6.3.tar.gz
  • Upload date:
  • Size: 115.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for djlintr-0.6.3.tar.gz
Algorithm Hash digest
SHA256 565721c1119d9bd294d509abc3982dad6f3b0e2ed34e7ff4813501f8bece1213
MD5 76bf36c9d9acf48cee9dddd3bc68ad79
BLAKE2b-256 1813efee1f570383f9fcb0ea42ab89d3e296ca7ab5f2b31ef32d0370d636e6ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for djlintr-0.6.3.tar.gz:

Publisher: pypi.yml on thraxil/djlintr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djlintr-0.6.3-py3-none-win_amd64.whl.

File metadata

  • Download URL: djlintr-0.6.3-py3-none-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for djlintr-0.6.3-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 12c79a1756275cde3f5831cd142edeeec8e7bf071dd1cf324197e7584c455bba
MD5 4704fc052cb0d446d9671b721be93d01
BLAKE2b-256 341c6d0e6e55a5ab97a784eb4a981c52f77c264e4287348723d86ed39db09456

See more details on using hashes here.

Provenance

The following attestation bundles were made for djlintr-0.6.3-py3-none-win_amd64.whl:

Publisher: pypi.yml on thraxil/djlintr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djlintr-0.6.3-py3-none-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for djlintr-0.6.3-py3-none-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8ac03e0ef02de73e8cc44db5317a80bfaf2efdeccdeb3484be903440ce9219f5
MD5 b7fc267c36ec7f4fa8e0cc588b314c0b
BLAKE2b-256 3a2c600d1c519c2ec5d94a225c0c5be729a002bb3dce21fff092fbac337bfb24

See more details on using hashes here.

Provenance

The following attestation bundles were made for djlintr-0.6.3-py3-none-manylinux_2_34_x86_64.whl:

Publisher: pypi.yml on thraxil/djlintr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djlintr-0.6.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for djlintr-0.6.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1615c1dba76c2b150d392ed79fbaa856ed08361c4cde8ad3271a3f1850b315b9
MD5 3e4f8e618c0326d0b3d2ae1d754b71d7
BLAKE2b-256 21ec6a080374c71451288852440581445c5ffad56281e2814f92222fa81172ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for djlintr-0.6.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: pypi.yml on thraxil/djlintr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djlintr-0.6.3-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for djlintr-0.6.3-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f8bbf6798fec9e2f94f0d614dceb8a8f03d201ac628c5298edfee86f99b89c0d
MD5 42a682dad9e8d0b8712d820e2616313d
BLAKE2b-256 e8d0a9ff769d32c0ba6d0214fdfe6b4a2d710ec1037a8dcd8fa8e8a895e38156

See more details on using hashes here.

Provenance

The following attestation bundles were made for djlintr-0.6.3-py3-none-macosx_11_0_arm64.whl:

Publisher: pypi.yml on thraxil/djlintr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djlintr-0.6.3-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for djlintr-0.6.3-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 adfb8731feae066dd1bdcf963f67554db2c89dd8e653d05ae747f38f5f98eb18
MD5 252ef4c4c4534e85cfbd44f8603e640b
BLAKE2b-256 503975b5ef58cf6540f783eeecb27a7d6f079335b62e5a671fc91a477dafab5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for djlintr-0.6.3-py3-none-macosx_10_12_x86_64.whl:

Publisher: pypi.yml on thraxil/djlintr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page