Using renderTemplate for a plain text twig template Is there a suitable way to use renderTemplate or another method to output a twig template that is plain text?

I'm working with a plugin that has an email template for both HTML and plain text, previewing the HTML version is simple, doing the same with the plain text works but the visual preview within Craft shows the content without any of the spacing or line breaks because its rendering as HTML, viewing the source the correct output with the line breaks and spacing etc is shown. I was wondering if there was a way to output the plain text template in a similar way.
This is isn't an elegant way of doing it, but essentially as per Stephen's suggestion, if you can wrap the plain text output in a pre block, the preview will visually render the spacing and line breaks in HTML mode in the same way it would be received via email.

You could do this in the actionPreview function itself, or alternatively in the template use a condition that would only be true when the email template is being accessed in Craft for this purpose. I chose to use craft.request

{% if craft.request.getLastSegment == 'emailPreviewPlain' %}
    {{ '&lt;pre&gt;' | raw }}
{% endif %}

{# Plain text template content goes here #}

{% if craft.request.getLastSegment == 'emailPreviewPlain' %}
    {{ '&lt;/pre&gt;' | raw }}
{% endif %}


This then wraps the entire twig template in pre tags when being previewed in Craft, but otherwise should not render when sent as an email.