Remove use of autoescape and |safe in templates

It's simpler to use `mark_safe()` in views for things that have specifically been escaped instead of `|safe`. The rest gets escaped automatically.