I read the Haml docs where they talk about the pre tag and "preserving whitespace". According to the docs, pre "preserves whitespace" by default and you need to use the ~ operator to output the contents of the tag to get it to render correctly. Following the recommended practice, I have this:
%pre
~ @calendar.main_template
The output in the browser:
(This may be a little confusing -- the app is letting the user manipulate Haml code, so I'm actually displaying Haml code here in the UI.)
%div
= events
What output want:
%div
= events
I also tried using = instead of ~. Also tried %pre>, %pre<, and %pre>< all with identical results.
You want preserve.
%pre
= preserve "I like\n Cheese"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With