Thursday, November 12, 2009

Displaying Ruby code on a blog

I spent a bit of time trying to figure out the best way to display Ruby code on this blog. Initially I just converted the code to Courier font but it looked ugly and was hard to work with.

I eventually found this link on Stack Overflow:

http://stackoverflow.com/questions/1644201/how-can-i-display-code-better-on-my-blogger-blog

There were a few other methods I found, such as this strategy to convert the code via a Ruby script to HTML and then put it in the clipboard. But I liked the Stack Overflow method the best because all I need to do is add these HTML tags to the code:

<pre class="brush: ruby" name="code">
(Code)
<pre>

Here's an example of what it looks like:

Class Foo
  def bar
  end
end

And here is how to widen the main text column so the code doesn't constantly get wrapped:

http://johndeeremom.blogspot.com/2008/07/how-to-widen-your-columns-on-blogger.html

7 Comments:

Blogger Vinoth Kumar said...

PLC Training in Chennai | PLC Training Institute in Chennai | PLC Training Center in Chennai | PLC SCADA Training in Chennai | PLC SCADA DCS Training in Chennai | Best PLC Training in Chennai | Best PLC Training Institute in Chennai | PLC Training Centre in Chennai | Embedded System Training in Chennai | Embedded Training in Chennai | VLSI Training in Chennai | VLSI Training Institute in Chennai

June 15, 2018 at 2:14 AM  
Blogger Vinoth Kumar said...

PLC Training in Chennai | PLC Training Institute in Chennai | PLC Training Center in Chennai | PLC SCADA Training in Chennai | PLC SCADA DCS Training in Chennai | Best PLC Training in Chennai | Best PLC Training Institute in Chennai | PLC Training Centre in Chennai | PLC SCADA Training in Chennai | Automation Training Institute in Chennai | PLC Training in Kerala

June 15, 2018 at 2:14 AM  
Blogger Vinoth Kumar said...

Embedded Training in Chennai | Best Embedded Training in Chennai | Embedded System Training in Chennai | Embedded System Training Institute in Chennai | Best Embedded System Training Institute in Chennai | Embedded Course in Chennai | Embedded System Training Institutes in Chennai | Embedded System Training Center in Chennai | Best Embedded System Training in Chennai | Embedded Systems Training in Chennai | VLSI Training in Chennai | VLSI Training Institute in Chennai

June 15, 2018 at 2:14 AM  
Blogger Vinoth Kumar said...

VLSI Training in Chennai | Best VLSI Training in Chennai | VLSI Training Centres in Chennai | VLSI Courses in Chennai | VLSI Training Courses in Chennai | VLSI Training Institute in Chennai | VLSI Training Institutes in Chennai | Best VLSI Training Institute in Chennai

June 15, 2018 at 2:15 AM  
Blogger Anbarasan14 said...

Thanks for your blog; I really prefer this blog for my future reference.
English Speaking Classes in Mulund
IELTS Classes in Mulund
German Classes in Mulund
French Classes in Mulund
Spoken English Classes in Chennai
IELTS Coaching in Chennai
English Speaking Classes in Mumbai
IELTS Classes in Mumbai
Spoken English Class in Anna Nagar
IELTS Coaching in Tambaram

September 3, 2019 at 10:54 PM  
Blogger kaushik said...

Wonderful article with great piece of information. Thanks for sharing this with us. I'll take reference from your blog. Do share more such informative articles.
Automation Anywhere Training in Chennai
Automation Training in Chennai
Automation Training Institute in Chennai
R Training in Chennai
Data Science Training in Chennai
RPA Training in Chennai
Automation Anywhere Training in Adyar
Automation Anywhere Training in Tambaram
Automation Anywhere Training in Anna Nagar

September 5, 2019 at 2:43 AM  
Blogger The India said...

PPC Service in Delhi
PPC Companies in Delhi
SEO Company in Delhi
SEO Company in Delhi NCR
SMO Company in Delhi
SMO Company in India

October 16, 2019 at 11:32 PM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home