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.
pre
tag?pre
wrapper in the template itself. Is it possible to wrap the renderTemplate function with<pre>
</pre>
or implement it another way?pre
tags. That feels a little hacky, but I can't think of a cleaner approach off the top of my head.pre
works great. I know what you mean. I think its the only way. I could add a function to make a check to see if the request has been made from Craft and then use that in Twig to outputpre
tags conditionally? Basically a condition that otherwise won't be true when the email actually gets sent.