Getting Textile to work with Digg This button (and other SCRIPT tags)

Textile is my favorite plain text to valid XHTML parser out there. It works beautifully simply, but is also very powerful too. It is much easier to show people how to use this than banging your head over rich text errors and oddness (as a former TinyMCE maintainer, I can validly say, “been there, done that”).

For Drupal, there is a wonderful textile module that the fine folks at Chapter Three LLC have taken over. This module works very simply and in my testing, is much more reliable and bug free in parsing when compared to Markdown with Smarty, which offers very similar parsing capabilities.

However, yesterday when I was working on the announcement for 2 Guys Uncorked, I ran into a problem. How the heck could I get Textile and the Digg This button to work together well?

After some reading, I found this forum post that detailed how to turn textile processing on and off inline. With some fiddling, I found the magic answer to be the following:

  1. notextile.. <div style="float:left; margin-right:1.5em;">
  2. <script>
  3. digg_url = 'http://digg.com/food_drink/2_Guys_Uncorked_launches';
  4. </script>
  5. <script src="http://digg.com/api/diggthis.js"></script>
  6. </div>
  7.  
  8. p. Family & Friends,

The key being to have the notextile.. being on the same line as the code it needed to stop processing and then having the p. on a new line, with a space separating the following content.

And voilĂ , textile continues to rock :)

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You can use Textile markup to format text.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <img> <pre>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options