+
+
+Converting a text to HTML
+-------------------------
+
+This function converts newline (`\n`) escape sequences in plain text to `
`
+tags for HTML rendering.
+
+The function can handle plain texts:
+
+ >>> text = "First\r\nSecond\r\nThird"
+ >>> api.text_to_html(text)
+ 'First\r
Second\r
Third
'
+
+Unicodes texts work as well:
+
+ >>> text = u"Ä\r\nÖ\r\nÜ"
+ >>> api.text_to_html(text)
+ '\xc3\x83\xc2\x84\r
\xc3\x83\xc2\x96\r
\xc3\x83\xc2\x9c
'
+
+The outer `` wrap can be also omitted:
+
+ >>> text = "One\r\nTwo"
+ >>> api.text_to_html(text, wrap=None)
+ 'One\r
Two'
+
+Or changed to another tag:
+
+ >>> text = "One\r\nTwo"
+ >>> api.text_to_html(text, wrap="div")
+ '
One\r
Two
'
+
+Empty strings are returned unchanged:
+
+ >>> text = ""
+ >>> api.text_to_html(text, wrap="div")
+ ''