Is there a way to display a field as <pre>formatted?

Hi all,

Ideally the output would be something like:

<pre>The text from my field, with all tabs and double spaces maintained and <p>'s stripped out</pre>

I’m trying to typeset poetry. Currently if I enter the pre tags at the start and end of the field it works (and strips out the p tags), however, I want this to be automated. Adding them before and after the field in the snippet/template does not work because the formatting is stripped when echo’ing ‘text()’

Thanks to anyone who can help!

You may want to have a look at Kirbytext pre and post filters :