Skip to main content

Django template indenter

Project description

DJHTML

A pure-Python Django template indenter without any dependencies.

Installation

You can install DJHTML with the following command:

$ pip install djhtml

Usage

Next, you can use it like so:

$ djhtml my-django-template.html

Pre-commit configuration

Even better, you can use DJHTML as a pre-commit hook to automatically indent your Django templates upon each commit.

First, add the following to your .pre-commit-config.yaml:

repos:
- repo: https://github.com/rtts/djhtml
  rev: main
  hooks:
  - id: djhtml

Then, run the following command:

$ pre-commit autoupdate

Results

Before:

{% block extrahead %}
<script>
function f() {
return 42;
}
</script>
{% endblock %}

After:

{% block extrahead %}
    <script>
        function f() {
            return 42;
        }
    </script>
{% endblock %}

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

djhtml-0.0.3.tar.gz (19.2 kB view details)

Uploaded Source

File details

Details for the file djhtml-0.0.3.tar.gz.

File metadata

  • Download URL: djhtml-0.0.3.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

File hashes

Hashes for djhtml-0.0.3.tar.gz
Algorithm Hash digest
SHA256 5d9d1ff24dcc8755be5a3e2b2ae2c0573102fd44c5de678efd616333e233ed41
MD5 45e0f5e358a2d9f89d0f57a1483c1696
BLAKE2b-256 5145bf5f048ab4eb544ce6bd8391776df04d2a941434960cb95889f62c639b2f

See more details on using hashes here.

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