I’m tired of settling for a WYSIWYG editor in my Rails apps. Plugins like FCKeditor and TinyMCE work moderately well for the end user, but they can generate ugly HTML on the backend. I hate dealing with that. Textile is so much better, but our clients often dislike dealing with the markup. Isn’t there a way to bridge the niceness of Textile with the end user experience of a WYSIWYG editor?

It turns out that there is: it’s the new textile_toolbar plugin. Extracted from a recent Terralien project, the plugin adds a handy toolbar to Textile-enabled form fields. The buttons on the toolbar generate the appropriate Textile markup for your users. For example, clicking the “Bold” button will surround the highlighted word with the correct Textile markup to make it bold.

textile_toolbar lets you retain the benefits of Textile while at the same time offering your users a friendly interface for generating markup. The plugin is a great way to learn Textile, but even if your users don’t want to bother with memorizing the markup, the toolbar will still be there to assist them with their editing.

It’s easy to get started with textile_toolbar. To install the plugin in your Rails 2.1 (or greater) project, run:


script/plugin install git://github.com/pelargir/textile_toolbar.git

To add the toolbar to an existing text area, change the text_area or text_field helper call to textile_area. It’s that simple! Be sure to check out the README for further integration guidelines and options.

Update: A live example of a Textile-enabled text area can now be found here.

Posted by Matthew Bass on Oct 29th, 2008

You can still contact Nathaniel at nathaniel@terralien.com