javascriptphpmysqlprettify

How can I make prettify code work in one line?


I load prettify.js and format my code as such:

x = a;
y = b;

It comes out all proper and pretty, but... I need to squeeze this code into an SQL column so it needs to be in one line without any hidden line breaks. I tried

x = a;\ny = b;

That doesn't work because \n is escaped within the prettified block so it comes out as above. Is there any way to "code in" line breaks into the prettified code?

Perhaps I'm looking at the problem from the wrong angle? My ultimate goal is to put the prettify code block into MySQL table. I have PHP and JavaScript at my disposal.


Solution

  • You can use the following syntax: (x = a) && (y = b); [node] ($x = $a) && ($y = $b); [php] Generally speaking you can take every statement, surround it by brackets and add the && between them