githubramakrishnan / google-code-prettify

Automatically exported from code.google.com/p/google-code-prettify
Apache License 2.0
0 stars 0 forks source link

prettyPrintOne with preformatted code #192

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
prettyPrintOne("function (x) {\n    return 1;\n}", "js");

removes all newlines and normalizes whitespaces (while IMHO it should keep the 
whitespaces untouched). That's because detection whenever the element's content 
is preformatted or not relies on computedStyles, which are not available in 
element that isn't attached to DOM.

I tested it in Google Chrome, but it's probably broken in other browsers too. 

I attached simple patch, but I believe it need some polishing. Having unit test 
would be nice to.

Original issue reported on code.google.com by Tomasz.E...@gmail.com on 14 Feb 2012 at 2:23

GoogleCodeExporter commented 9 years ago
Sorry, here's the patch

Original comment by Tomasz.E...@gmail.com on 14 Feb 2012 at 2:27

Attachments:

GoogleCodeExporter commented 9 years ago
Quite right.  Thanks for the patch.  Fix should be forthcoming soon.

Original comment by mikesamuel@gmail.com on 30 Mar 2012 at 2:46

GoogleCodeExporter commented 9 years ago
Fixed at http://code.google.com/p/google-code-prettify/source/detail?r=201#

Original comment by mikesamuel@gmail.com on 30 Mar 2012 at 3:20