0

I have text stored on Parse.com in the filed of type string. The text consists of white-spaces such as end of line character/ new line

While displaying this text in HTML like paragraph.get('text') the new line characters are stripped.

How can I display the entire text with its formatting in HTML?

Cyprian
  • 9,423
  • 4
  • 39
  • 73
  • Is parse stripping the whitespace? If it isn't, then this question isn't about parse.com at all. – danh Dec 27 '15 at 17:50

1 Answers1

1

Option 1: Put your text between two pre tags:

<pre>
 Text in a pre element
 is displayed in a fixed-width
 font, and it preserves
 both      spaces and
 line breaks
</pre> 

Options 2: use a regular expression (tons of examples out there) to replace your newline characters with something like a < br /> tag

Bindrid
  • 3,655
  • 2
  • 17
  • 18