2
2
3
3
*** A pure-Python Django/Jinja template indenter without dependencies.***
4
4
5
+ ``` jinja
6
+ {% block content %}
7
+ <blockquote
8
+ cite="Guido Van Rossum"
9
+ class="Pythonic"
10
+ >
11
+ {% blocktranslate trimmed %}
12
+ Don't you hate code that's not properly indented?
13
+ {% endblocktranslate %}
14
+ </blockquote>
15
+ {% endblock %}
16
+ ```
17
+
5
18
DjHTML indents mixed HTML/CSS/JavaScript templates that contain
6
19
[ Django] ( https://docs.djangoproject.com/en/stable/ref/templates/language/ )
7
20
or [ Jinja] ( https://jinja.palletsprojects.com/templates/ ) template
@@ -15,64 +28,6 @@ other characters. The goal is to correctly indent already
15
28
well-structured templates, not to fix broken ones.
16
29
17
30
18
- ### New! Multi-line HTML elements
19
-
20
- As of version 3, DjHTML indents multi-line HTML elements and
21
- multi-line attribute values like this:
22
-
23
- ``` jinja
24
- <blockquote cite="Guido Van Rossum"
25
- style="font-style: italic;
26
- {% if dark_mode %}
27
- background: black;
28
- {% endif %}
29
- ">
30
- Don't you hate code that's not properly indented?
31
- </blockquote>
32
- ```
33
-
34
-
35
- ### New! Multi-line CSS indentation
36
-
37
- Multi-line CSS values are now continued at the same indentation level:
38
-
39
- ``` jinja
40
- <style>
41
- @font-face {
42
- font-family: Helvetica;
43
- src: {% for format, filename in licensed_fonts %}
44
- url('{% static filename %}') format('{{ format }}'),
45
- {% endfor %}
46
- url('Arial.woff2') format('woff2'),
47
- url('Arial.woff') format('woff');
48
- }
49
- </style>
50
- ```
51
-
52
-
53
- ### New! Improved JavaScript indentation
54
-
55
- Many new JavaScript indention rules have been added, such as the
56
- indentation of method chaining:
57
-
58
- ``` jinja
59
- <script>
60
- window.fetch('/test.html')
61
- .then((html) => {
62
- document.body.innerHTML = html;
63
- {% block extra_statements %}
64
- {% endblock %}
65
- });
66
- </script>
67
- ```
68
-
69
-
70
- ### New! Tabwidth guessing
71
-
72
- Without the ` -t ` / ` --tabwidth ` argument, DjHTML no longer defaults to
73
- a tabwidth of 4 but instead guesses the correct tabwidth.
74
-
75
-
76
31
## Installation
77
32
78
33
DjHTML requires Python 3.8 or higher and is compatible with all
0 commit comments