Robot Has No Heart

Xavier Shay blogs here

A robot that does not have a heart

Lesstile - A yuletide present

Textile is great for formatting articles. But comments aren’t articles, and I have always felt that textile was overkill. Do you really need nested headings and subscript in comments? No.

Also! And more importantly, textile doesn’t output valid XHTML. Consider the following textile code:

1
2
3
4
5
<b>
Hello

This is broken
</b>

Converts to:

1
2
3
<p><b>
Hello</p>
<p>This is broken</b></p>

That sucks if your blog happens to be XHTML strict, because then your site is broken :( So I made an alternative. I offer it as a present to you: Lesstile

Try it out, it’s pretty neat:

1
gem install lesstile
1
2
3
4
5
6
7
8
9
require 'lesstile'

Lesstile.format_as_xhtml <<-EOS
Wow this is ace!

--- Ruby
def some_code
  "yay code"
end

EOS

It supports code blocks, and that’s it. You can easily pass it through CodeRay to get syntax highlighting if you want – see the docs. In the future it may also support hyperlinking. That’s all I suppose commenters on this blog need, maybe you will tell me otherwise. Try it out on this post.

As a special extra treat, I added live preview to this blog, so you can see what your comment is going to look like as you write. It’s just like the future!

Please comment with code to say hi.

  1. Justin French says:

    --- Ruby
    require 'lobbyist'
    5.times { Lobby

  2. Xavier Shay says:

    *ahem*

    1
    2
    3
    4
    5
    6
    
    require 'bugfixer'
    
    bugs = ["Long OpenID comments are broke", "comment helper doesn't provide lesstile link"]
    bugs.each do |bug|
      bug.fix!
    end
    

Post a comment


(lesstile enabled - surround code blocks with ---)

A pretty flower Another pretty flower