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

16 Comments:

Blogger Tony Stark 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 Tony Stark 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 Tony Stark 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 Tony Stark 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  
Blogger Flora said...

Thanks for sharing wonderful information. I loved reading your article.
use of python programming
highest paying skills
scope of hadoop
hadoop scope in future
java interview questions and answers for freshers
selenium interview questions and answers pdf

February 2, 2021 at 1:22 AM  
Blogger Shiva Shakthi said...

Great Post!!! thanks for sharing this wonderful post with us.
Hadoop Training in Chennai
Big Data Training in Chennai
Big Data Training in Bangalore
Big Data Course in Coimbatore
Bigdata Training Online

February 25, 2021 at 4:29 AM  
Blogger Shiva Shakthi said...

Wonderful Blog!!! Waiting for your upcoming data... thanks for sharing with us.
Software Testing Training in Chennai
Software Testing Online Course
Software Testing Course in Coimbatore



March 3, 2021 at 4:32 AM  
Blogger Quimesherlie871 said...

스포츠토토

토토

I truly desired the articles it’s truly wonderful best author

May 4, 2021 at 10:50 PM  
Blogger Quimesherlie871 said...

I was looking forward to more updates. KEEP POSTING!! XAIO

토토
스포츠토토

May 4, 2021 at 10:51 PM  
Blogger Quimesherlie871 said...

온라인카지노
카지노사이트

I truly desired the articles it’s truly wonderful best author

May 4, 2021 at 10:52 PM  
Blogger Quimesherlie871 said...

Great offer the previous results outstanding vital necessary info right here

온라인카지노사이트

카지노사이트

May 4, 2021 at 10:53 PM  
Blogger 휴게텔 said...

강남오피

That is a very good tip especially to those new to the blogosphere.
Short but very accurate info… Appreciate
your sharing this one. A must read post
I want to start a blog to write about everything that happens at school and
with friends…anonymously…any sugestions?.

June 30, 2021 at 4:01 AM  
Blogger bamgosoocom said...

Thanks for ones marvelous posting! I really enjoyed reading it, you might be a great author. I will be 휴게텔
sure to bookmark your blog and will eventually come back later on.

July 1, 2021 at 5:22 PM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home