Skip to main content

jinja2-indent

This Jinja2 extension adjusts the indentation of block content to a specified width.

PyPI Build Status Software license

Compatibility

  • python >= 3.9

Installation

Install the latest release with pip:

pip install jinja2-indent

Usage

The {% indent %} tag provided by this extension allows you to adjust the indentation level of the content inside the tag block. You can specify the desired width (in spaces), and the extension will reformat the content accordingly. This is particularly useful for aligning nested or indented structures in templates.

Example

The following example demonstrates how to increase the indentation of a block of text:

root:
{% indent 2 %}
- name: a
  value: 1

- name: b
  value: 2

- name: c
  value: 3
{% endindent %}
root:
  - name: a
    value: 1

  - name: b
    value: 2

  - name: c
    value: 3

The following example demonstrates how to remove unnecessary indentation from a block of text:

- name: a
  value: 1

{% indent 0 %}
  - name: b
    value: 2
{% endindent %}

- name: c
  value: 3
- name: a
  value: 1

- name: b
  value: 2

- name: c
  value: 3

Metadata

Release files for jinja2-indent 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jinja2-indent 0.3.0
File Size Uploaded
jinja2_indent-0.3.0.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jinja2-indent 0.3.0
File Interpreter ABI Platform
jinja2_indent-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.5 kB

Release files / jinja2_indent-0.3.0.tar.gz

Download URL jinja2_indent-0.3.0.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b803171d17f26fbb6a541749d15d2946c049ee5489ac771af7659953c45c69a3
BLAKE2b-256 checksum
How to use checksums
86c23dc5ff71d68f5456ee63be2daa90642fc25450b4b88aabf673b83bd69013
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.12.8 Linux/6.5.0-1025-azure

Release files / jinja2_indent-0.3.0-py3-none-any.whl

Download URL jinja2_indent-0.3.0-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbc140b02a8d019ccab44a25f2062352ef369685e89a5a0d1ca3c14b95474f69
BLAKE2b-256 checksum
How to use checksums
49223624a10c64a5ba59b5d882e7f08819e02b2f3f2953ffa6de7030978be760
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.12.8 Linux/6.5.0-1025-azure

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page