write ruby code on a blog

A

aidy

Hi,

Anyone got any ideas on how to easily write and correctly display
(with syntax highlighting) Ruby code on a blog?

Regards,

Aidy
 
K

Karl von Laudermann

Hi,

Anyone got any ideas on how to easily write and correctly display
(with syntax highlighting) Ruby code on a blog?

In the past I've done this using Vim. Vim has a command called
something like TOhtml, which will take the displayed file (such as
ruby code) and generate an html file that displays the code with the
same syntax coloring that Vim itself displays the code in. I've done
this manually by loading the desired file into Vim, executing the
command, then saving the resulting file to an .html file, but I
wouldn't be surprised if there's a way to automate it.
 
F

Florian Gilcher

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi,

Anyone got any ideas on how to easily write and correctly display
(with syntax highlighting) Ruby code on a blog?

Regards,

Aidy

You could run it through CodeRay which is a Syntax Highlighter written
in Ruby.

http://coderay.rubychan.de/

Greetings
Florian Gilcher
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkgE1BgACgkQJA/zY0IIRZZMQQCfeyjAQ1Nk73RRX+HQQmIv6PSL
usoAoMvtjPspjndfWps2mPbaa8NkalDA
=WhB6
-----END PGP SIGNATURE-----
 
G

Gregory Seidman

In the past I've done this using Vim. Vim has a command called
something like TOhtml, which will take the displayed file (such as
ruby code) and generate an html file that displays the code with the
same syntax coloring that Vim itself displays the code in. I've done
this manually by loading the desired file into Vim, executing the
command, then saving the resulting file to an .html file, but I
wouldn't be surprised if there's a way to automate it.

I missed the original post, but this is what I use for my blog:

http://redcorundum.blogspot.com/2006/07/syntax-coloring.html

--Greg
 
J

James Gray

Anyone got any ideas on how to easily write and correctly display
(with syntax highlighting) Ruby code on a blog?

If you use TextMate as your editor, you can convert your code to
syntax highlighted HTML using the "Create HTML From Document" command
in the "TextMate" bundle.

James Edward Gray II
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,006
Latest member
LauraSkx64

Latest Threads

Top