diff --git a/example.html b/example.html
index c8440dc..e0e0c5c 100644
--- a/example.html
+++ b/example.html
@@ -1 +1,393 @@
-
The Title
The Subject
The Author
The Place, 2020-01-01
The First Section
The first paragraph.
The second paragraph.
We allow attachments. Nice, isn't it?
The Second Section
The Subsection
The first paragraph.
The second paragraph.
The second paragraph.
A definition list
This is a definition list:
- term 1
definition 1
- term 2
definition 2
A table
This is a table, but may be not that much pretty:
Heading 1 | Heading 2 |
---|
A1 | A2 |
B1 | B2 |
A list
This is an unordered list, a long one:
First list item
With a second paragraph inside! BTW Armour-piercing fin-stabilized discarding sabot (APFSDS), long dart penetrator, or simply dart ammunition is a type of kinetic energy penetrator ammunition used to attack modern vehicle armour.
Item 0
Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8
Item 9
Item 10
Item 11
Item 12
Item 13
Item 14
Item 15
Item 16
Item 17
Item 18
Item 19
Item 20
Item 21
Item 22
Item 23
Item 24
Item 25
Item 26
Item 27
Item 28
Item 29
Item 30
Item 31
Item 32
Item 33
Item 34
Item 35
Item 36
Item 37
Item 38
Item 39
Item 40
Item 41
Item 42
Item 43
Item 44
Item 45
Item 46
Item 47
Item 48
Item 49
\ No newline at end of file
+
+
+
+
+ The Title
+
+
+ The Subject
+
+ The Author
+
+ The Place, 2020-01-01
+
+
+
+ The First Section
+
+
+ The first paragraph.
+
+
+ The second paragraph.
+
+
+ We allow
+
+ attachments
+
+ . Nice, isn't it?
+
+
+
+
+ The Second Section
+
+
+ The Subsection
+
+
+ The first paragraph.
+
+
+ The second paragraph.
+
+
+ The second paragraph.
+
+
+
+
+ A definition list
+
+
+ This is a definition list:
+
+
+ -
+ term 1
+
+ -
+
+ definition 1
+
+
+ -
+ term 2
+
+ -
+
+ definition 2
+
+
+
+
+
+
+ A table
+
+
+ This is a table, but may be not that much pretty:
+
+
+
+
+
+ Heading 1
+ |
+
+ Heading 2
+ |
+
+
+
+
+
+ A1
+ |
+
+ A2
+ |
+
+
+
+ B1
+ |
+
+ B2
+ |
+
+
+
+
+
+
+ A list
+
+
+ This is an unordered list, a long one:
+
+
+ -
+
+ First list item
+
+
+ With a second paragraph inside! BTW Armour-piercing fin-stabilized discarding sabot (APFSDS), long dart penetrator, or simply dart ammunition is a type of kinetic energy penetrator ammunition used to attack modern vehicle armour.
+
+
+ -
+
+ Item 0
+
+
+ -
+
+ Item 1
+
+
+ -
+
+ Item 2
+
+
+ -
+
+ Item 3
+
+
+ -
+
+ Item 4
+
+
+ -
+
+ Item 5
+
+
+ -
+
+ Item 6
+
+
+ -
+
+ Item 7
+
+
+ -
+
+ Item 8
+
+
+ -
+
+ Item 9
+
+
+ -
+
+ Item 10
+
+
+ -
+
+ Item 11
+
+
+ -
+
+ Item 12
+
+
+ -
+
+ Item 13
+
+
+ -
+
+ Item 14
+
+
+ -
+
+ Item 15
+
+
+ -
+
+ Item 16
+
+
+ -
+
+ Item 17
+
+
+ -
+
+ Item 18
+
+
+ -
+
+ Item 19
+
+
+ -
+
+ Item 20
+
+
+ -
+
+ Item 21
+
+
+ -
+
+ Item 22
+
+
+ -
+
+ Item 23
+
+
+ -
+
+ Item 24
+
+
+ -
+
+ Item 25
+
+
+ -
+
+ Item 26
+
+
+ -
+
+ Item 27
+
+
+ -
+
+ Item 28
+
+
+ -
+
+ Item 29
+
+
+ -
+
+ Item 30
+
+
+ -
+
+ Item 31
+
+
+ -
+
+ Item 32
+
+
+ -
+
+ Item 33
+
+
+ -
+
+ Item 34
+
+
+ -
+
+ Item 35
+
+
+ -
+
+ Item 36
+
+
+ -
+
+ Item 37
+
+
+ -
+
+ Item 38
+
+
+ -
+
+ Item 39
+
+
+ -
+
+ Item 40
+
+
+ -
+
+ Item 41
+
+
+ -
+
+ Item 42
+
+
+ -
+
+ Item 43
+
+
+ -
+
+ Item 44
+
+
+ -
+
+ Item 45
+
+
+ -
+
+ Item 46
+
+
+ -
+
+ Item 47
+
+
+ -
+
+ Item 48
+
+
+ -
+
+ Item 49
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/example.py b/example.py
index aec2a62..97a8b87 100644
--- a/example.py
+++ b/example.py
@@ -102,7 +102,7 @@
from red_tape_kit.html import HTMLRenderer
from red_tape_kit.pdf import FPDFRenderer
with open('example.html', 'wb') as fp:
- HTMLRenderer(doc).render(fp)
+ HTMLRenderer(doc).render(fp, indent='\t')
with open('example.pdf', 'wb') as fp:
FPDFRenderer(doc).render(fp)
with open('example.docx', 'wb') as fp:
diff --git a/red_tape_kit/html.py b/red_tape_kit/html.py
index a0114e2..a4c5d17 100644
--- a/red_tape_kit/html.py
+++ b/red_tape_kit/html.py
@@ -136,5 +136,8 @@ def add_attachment(self, html_el, attachment):
a.set('href', f'data:application/octet-stream;base64,{b64_str}')
self.add_inline_element(a, attachment.text)
- def render(self, f):
- ET.ElementTree(self.root).write(f, encoding='utf-8', method='html')
+ def render(self, f, indent=None):
+ tree = ET.ElementTree(self.root)
+ if indent is not None:
+ ET.indent(tree, space=indent, level=0)
+ tree.write(f, encoding='utf-8', method='html')