Is there a way to display an attached txt file rather than require it be downloaded?

AI-generated summary

MikeNolan is looking for a way to display attached .txt files in a post instead of requiring them to be downloaded. Initially, MikeNolan thought it was a Discourse setting, but then believed it was controlled by browser settings. However, Escovan suggested using literal text inclusion, which would require manually copying and pasting the contents, as noted by NateDhaliwal and Heliosurge. Heliosurge also mentioned a theme component for inline PDF previews, but it only works on desktop. pfaffman suggested that a custom theme component could be created to insert the file into the DOM, although this has been discussed before with similar conclusions.

We have a category for reports that are sent via email to staff, board members and others.

We’ve set it up so these are also posted to a category called Reports.

However, the only option I’m seeing is to download the file, when what I’d really like is for it to be displayed on-screen. (They’re fixed field formatted reports, which is why we’re doing them via attachments, otherwise email programs will mess up the column formatting.)

Is there a way to have a .txt file displayed in a post?

Apparently this is controlled at the browser settings level, so never mind.

The easy solution would be for you to use the literal text inclusion (CTRL+e) like this:

This would be the content of you text file
It's fixed formatted
Good luck

But wouldn’t the user have to manually copy and paste the contents in?

I believe so. If pdf can work for your needs there is this theme component. But says desktop only.

This has come up several times and seems to have had the same answers.

Seems like there might be a way to make a theme component that would insert the file into the DOM if you really wanted ot.