Returning a String with line break from an Apex method (AuraEnabled)

Thanks to EricSSH's suggestion of escape="false", I did a quick search for any Aura tags that would escape HTML, and found

This did help me include a line break within a String with the use of '< br/>' and displaying it on the component as follows

<aura:unescapedHtml value="{!v.yourString}" />

I needed a solution that didn't require modifying the string and found this to work in Chrome and Firefox.


The <pre/> html tag diplays text in a fixed-width non-wrapped text, but the following CSS made it blend in with the rest of the page.

.THIS pre {
    white-space: pre-wrap;       /* Since CSS 2.1 */
    white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
    white-space: -pre-wrap;      /* Opera 4-6 */
    white-space: -o-pre-wrap;    /* Opera 7 */
    word-wrap: break-word;       /* Internet Explorer 5.5+ */
    font-family: inherit !important;