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.2.tar.gz (114.5 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.2-py3-none-win_amd64.whl (1.3 MB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.34+ x86-64

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

Uploaded Python 3manylinux: glibc 2.17+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

djlintr-0.6.2-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.2.tar.gz.

File metadata

  • Download URL: djlintr-0.6.2.tar.gz
  • Upload date:
  • Size: 114.5 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.2.tar.gz
Algorithm Hash digest
SHA256 d887380f4d5ac8dd02541282a917dc0b039209608aabaafc7b4887c97f63b29e
MD5 96cedb22571fcbcba110997fa19e3ca1
BLAKE2b-256 493fcfb7ccd27e5e6b17b77d942b0c8c0c2b8f0877b0b74e1272b5632db9afd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for djlintr-0.6.2.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.2-py3-none-win_amd64.whl.

File metadata

  • Download URL: djlintr-0.6.2-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.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 26dea4f13cb664e7058485de97c9f53c43000ed84efd16bb6a05a25d365f6b8b
MD5 be9c7a90a2d5b20c49a8e5f5ac9f86d8
BLAKE2b-256 947c02e1d6fbb9bed089ff1c36219fd3a9522fbc3cd91616159f7a14824bc157

See more details on using hashes here.

Provenance

The following attestation bundles were made for djlintr-0.6.2-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.2-py3-none-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for djlintr-0.6.2-py3-none-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e0d66bb9ed8820b3ee52fafb6a012f1ecfa23ac342c42d3278d537a046fea96f
MD5 5f129c9cd790658c18e5f7d096570ab7
BLAKE2b-256 874f657bcbd65ccc8c18e8a5f90d2f1bed0ff2b9746ed69972d8bce336bc4497

See more details on using hashes here.

Provenance

The following attestation bundles were made for djlintr-0.6.2-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.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for djlintr-0.6.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f36c80d41e3f1885ce6f6ff6351dbf5d0b401fdfad7c49e270398d223663010a
MD5 99422fdec0a76c1e3897c37a61136998
BLAKE2b-256 a58fe3520c4f5d7171e246bb4155cb4292aeec407757ffda12695f5070aad68e

See more details on using hashes here.

Provenance

The following attestation bundles were made for djlintr-0.6.2-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.2-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for djlintr-0.6.2-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0dc6e3a628c094f82a5d035b1d02ba3553d203bd7097387400833aff3d169264
MD5 4aecfd095e442f4a7d1daf42cee8dfa4
BLAKE2b-256 fbc2aa6f6d9c07a81cb63e05b9c6cdf7c7d121944dd32af0cb402f6519689fd6

See more details on using hashes here.

Provenance

The following attestation bundles were made for djlintr-0.6.2-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.2-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for djlintr-0.6.2-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2ac113f627833141dbf03f784e69fac0a11cd87c97199e948dac2744f72ae09f
MD5 67d998a6713d2c1b2546551ee49471f9
BLAKE2b-256 9d4fe978180a910093a1276dd38b1f469d89ec27f3b8deb0fd31b50f9aaa7c9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for djlintr-0.6.2-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