Preformatted text loses line breaks

drewc
2 Posts
drewc posted this 26 December 2020
Report a bug

When using the <pre> tag in an HTML element, the result looks okay in the WYSIWYG editor but the line breaks are stripped out in the browser. An odd indent is also added at the front.

If you add an HTML element to any block and paste in this text, you can observe the difference:

<pre>
<code>
public class MyClass {


  public int myVariable;


  void Start() {
    if( myVariable > 0 ) DoAThing( myVariable );
  }


  public void DoAThing( int input ) {
    // etc.
  }
}
</code>
</pre>
When using the &lt;pre&gt; tag in an HTML element, the result looks okay in the WYSIWYG editor but the line breaks are stripped out in the browser. An odd indent is also added at the front. If you add an HTML element to any block and paste in this text, you can observe the difference: <pre> <code> public class MyClass { public int myVariable; void Start() { if( myVariable > 0 ) DoAThing( myVariable ); } public void DoAThing( int input ) { // etc. } } </code> </pre>

Last edited 26 December 2020 by drewc

Vote to pay developers attention to this features or issue.
3 Replies
Order By: Standard | Newest
Support Team
Support Team posted this 28 December 2020

Hi,

I do not see extra line breaks on my side but see the first-line indentation. The strange this is that there are no extra spaces in the page source and no space added by the Nicepage stylesheet. Looks like this issue related to the execution of the CODE tag by the browser. I've removed it, and the code looks ok. You do not need it, as the example does not contain the code that can be executed on the front end.

...................................................
Sincerely,
Olivia
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hi, I do not see extra line breaks on my side but see the first-line indentation. The strange this is that there are no extra spaces in the page source and no space added by the Nicepage stylesheet. Looks like this issue related to the execution of the CODE tag by the browser. I've removed it, and the code looks ok. You do not need it, as the example does not contain the code that can be executed on the front end. ................................................... Sincerely, Olivia Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
drewc
2 Posts
drewc posted this 28 December 2020

Thanks for getting back to me so soon.

I also see the line breaks now, so their disappearance must have been my mistake – I copied and pasted some code; maybe it had nonstandard line break symbols.

Like you, I see the indentation go away when omitting the code tags. Thank you for the workaround!

Thanks for getting back to me so soon. I also see the line breaks now, so their disappearance must have been my mistake – I copied and pasted some code; maybe it had nonstandard line break symbols. Like you, I see the indentation go away when omitting the code tags. Thank you for the workaround!
Support Team
Support Team posted this 30 December 2020

Hi,

I'm glad that everything is ok now.
Please let us know if you need our further assistance.

...................................................
Sincerely,
Olivia
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hi, I'm glad that everything is ok now. Please let us know if you need our further assistance. ................................................... Sincerely, Olivia Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
You must log in or register to leave comments