2

Hey I have a weird problem, I use the google-code-prettify code to display code on my blog, but somehow the pre tags don't really preserve the whitespace. For some reason, the whitespace is doubled and sometimes tripled when posting, making the code sections look awful. I use a local installation of the code, and my code sections are enclosed with:

<?prettify?>
<pre class="prettyprint">
    [code here]
</pre>

I have never had any issues with this before, anyone seen anything similar and know of a remedy?

Chris
  • 89
  • 1
  • 1
  • 10
  • 1
    If you're indenting with tabs, you probably need to set the tab size to 4: `tab-size:4` in the CSS. – Dave Jan 27 '14 at 07:24
  • Already done, but good tip, I could try switching it to use space instead. – Chris Jan 27 '14 at 07:25
  • In that case, does it appear correctly when you view the content in the elements view of the developer tools? It sounds like prettify might just be choosing some unexpected indentation, rather than any error in how it's displayed. What does the code you're prettifying look like? – Dave Jan 27 '14 at 07:29
  • Like this: public class User { private String email; @Id @Column(name="email") public String getEmail() { return this.email; } } – Chris Jan 27 '14 at 07:38
  • Looks like Java. Did you tell the library the language? – Dave Jan 27 '14 at 07:42
  • No, I did not, I will look into that as well. Thanks! – Chris Jan 27 '14 at 07:48

0 Answers0