Refactor markdown rendering to support various attachment types including images, PDFs, audio, and videos. Update related tests and views for improved functionality and styling.