This reduces code duplication and makes this easier to re-use for plugins.
Additionally, it fixes two issues with attachment rendering:
- for many attachments we weren't showing links, making it unnecessarily hard to save or open them
- we were double-escaping attachment labels and descriptions