Forum

Thread tagged as: Question

Why does Perch enter white space in markup?

There are lines where I assume perch tags have been stripped from the markup post processing, so can this be stopped at all so the codepage is not unnecessarily lengthily?

Garth Holmes

Garth Holmes 1 points

  • 6 years ago

Removing any indentation and white space in your templates can help with this although that may make the code less readable. I'm not sure why it's a particular issue though?

You could strip white space post perch by returning the region to a variable then use PHP's trim() function, then output the results to page.

There may be other options too, but this is simple to do.... so I like it.

Robert Ketter

I will look at the trim() PHP function but this is occurring as a result of .html templates and my view is Perch should clean up before rendering any code.

In addition if I put Perch statements on the same line as HTML code, there are no longer any carriage returns.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you talking about whitespace in your HTML source?

Drew McLellan said:

Are you talking about whitespace in your HTML source?

yes

Drew McLellan

Drew McLellan 2638 points
Perch Support

HTML is not sensitive to whitespace - what problem are you seeing as a result?

It is so I can read what I am generating. thanks