A Jinja2 extension for managing indentation in templates.
Project description
jinja2-indent
This Jinja2 extension adjusts the indentation of block content to a specified width.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jinja2_indent-0.3.0.tar.gz.
File metadata
- Download URL: jinja2_indent-0.3.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.12.8 Linux/6.5.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b803171d17f26fbb6a541749d15d2946c049ee5489ac771af7659953c45c69a3
|
|
| MD5 |
0b608c643a90de0d71d8981f3a722249
|
|
| BLAKE2b-256 |
86c23dc5ff71d68f5456ee63be2daa90642fc25450b4b88aabf673b83bd69013
|
File details
Details for the file jinja2_indent-0.3.0-py3-none-any.whl.
File metadata
- Download URL: jinja2_indent-0.3.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.12.8 Linux/6.5.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbc140b02a8d019ccab44a25f2062352ef369685e89a5a0d1ca3c14b95474f69
|
|
| MD5 |
95daa5b7ae3423f59827b761afe0e86f
|
|
| BLAKE2b-256 |
49223624a10c64a5ba59b5d882e7f08819e02b2f3f2953ffa6de7030978be760
|