The Accidental Rubyist

invalid byte sequence in UTF-8

ecto and Markdown

leave a comment »

#!/usr/bin/env ruby
# Markdown'ise things.
# Take Markdown markup on STDIN, and output HTML to STDOUT
require 'rubygems'
require 'bluecloth'
#print (
file = ARGV[0];
text =,"r").readlines.join;
html = ( text).to_html, "w").puts html;

I must first admit that since ecto supports a WYSIWYG editor therefore a script that does textile or markdown filtering does not make much sense. Also, there is the possibility of the confusion being created. Thus the textile and Markdown examples are more of examples of what can be done. A more practical example is the inter.rb given somewhere in the previous post.

Anyway, that said, the above example requires ruby, rubygems and the BlueCloth gem to be installed. If you are running Unix or Mac OS X (which you should be), you would have ruby. Install rubygems, and then install BlueCloth as:

sudo gem install BlueCloth

(sudo is required for OS X.)


Written by totalrecall

February 28, 2007 at 7:05 pm

Posted in ecto, Mac OS X, ruby

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: