Search code examples
htmlhtmltidytypo3-flow

How to remove blank space from the source code using TYPO3 Flow?


I'm getting unnecessary space in my source code when executing the main page. No clue from where this space is coming from. It was coded using TYPO3 Flow (formerly Flow3) concepts. I need to call one XML file - but because of the blank spaces it doesn't satisfy the xml rules

It showing 27 blank lines, and in the 27th line it starts to display the markup, just like this layout:

 ...
 ...
 24
 25
 26
 27 <!DOCTYPE html>
 28   <head>
 29      <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
 30      <title>REST Test</title>
 ...
 ...

Solution

  • Use a plugin (like TS Tidy) or similar.

    Any similar plugin will format your HTML when its rendered by the server and before it is sent to the browser. Remove blank lines, indent tags, etc. Most of these plugins, in any engine or language, are based on the venerable HTMLTidy/XMLTidy.