How to print the \n character in Jinja2
I'll answer my own, maybe it helps someone who has the same question.
This works: {{thestring.encode('string_escape')}}
I have the following string in Python: thestring = "123\n456"
In my Jinja2 template, I use {{thestring}} and the output is:

123
  456

The only way I can get Jinja2 to print the exact representation 123\n456 (including the \n) is by escaping thestring = "123\\n456".
Is there any other way this can be done directly in the template?