# Pretty-Printing (X)HTML Output

**URL:** <https://www.ruby-forum.com/t/pretty-printing-x-html-output/55286>\
**Category:** Rails\
**Created:** [March 19, 2006, 3:36am UTC](https://www.ruby-forum.com/t/pretty-printing-x-html-output/55286 "2006-03-19T03:36:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![uberkorp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/7ab992/32.png) [@uberkorp](https://www.ruby-forum.com/u/uberkorp)\
**Post date:** [March 19, 2006, 3:36am UTC](https://www.ruby-forum.com/t/pretty-printing-x-html-output/55286/1 "2006-03-19T03:36:28Z")

</div>

I’ve gone down (hopefully the correct) route of breaking up my layout(s)  
into  
common/generic elements such as the html head etc, but when the page  
renders  
there is no consistency in indenting - it’s all over the place (I’ve  
de-tabbed everything with the same result).

Is there a standard/existing way of pretty-printing output? I’ve  
searched  
without any real joy, only a brief mention of ‘pp’ which I don’t know  
how to  
use in this context (or even if it’s correct).

I’m utilising partials… my bad?

thanks in advance for any tips/solution

---

<div class="post-metadata">

**Author:** ![uberkorp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/7ab992/32.png) [@uberkorp](https://www.ruby-forum.com/u/uberkorp)\
**Post date:** [March 19, 2006, 4:12am UTC](https://www.ruby-forum.com/t/pretty-printing-x-html-output/55286/2 "2006-03-19T04:12:42Z")

</div>

Alas Scott, html output seems to get no respect in the rails world…  
The books, the  
tutorials, the apidocs… nothing ever says what specific html the magic  
rails  
incantations will produce. And what it produced is thrown all  
willy-nilly into the page.  
Same thing in the java world though… no one cares about html. Sigh.

Anyway, I’ve seen folks recommend the ruby-tidy bridge[1]. Also I would  
think that if you  
built your pages with Builder[2] (as xhtml docs), that would probably  
create a  
pretty-printed dump.

Good luck,

b

[1][http://tidy.rubyforge.org/](http://tidy.rubyforge.org/)  
[2][Peak Obsession](http://api.rubyonrails.com/classes/Builder/XmlMarkup.html)

---

<div class="post-metadata">

**Author:** ![uberkorp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/7ab992/32.png) [@uberkorp](https://www.ruby-forum.com/u/uberkorp)\
**Post date:** [March 19, 2006, 4:24am UTC](https://www.ruby-forum.com/t/pretty-printing-x-html-output/55286/3 "2006-03-19T04:24:56Z")

</div>

Cheers Ben, I just thought I was missing something obvious - although I  
guess  
Builder could be called that! - “just output xml and stop mincing about  
already!!!”

I _had_ overlooked one rhtml file’s tabs though so at least it’s all  
coming  
out neatly, if not indented, now.

builder test it is then, thanks again.
