Skip to content

Textile Plugin 2.6 released

[announce] Note: A newer version is available. Please see the category page for the latest.

Another release of Textile by Dean Allen in his blogging tool TextPattern 4.0 has prompted me to make another release of my pluing based on his work. This release is so much better than the last couple, that I really want to just call it Textile 3. I won’t though, because that would confuse everyone, including me.

At any rate, this release improves block handling, and the ‘notextile’ tag (or double equals) actually works as advertised ( *check out* this "textile":1 code that was _not_ converted! ). Actually, that example brings us to another new feature: You can move the URLs out of your code, (even for images) and refer to them by number.

This release is also a lot better about not screwing up when you insert html into your posts, so this, for instance was done with a pair of <b> tags instead of textile markup. That means that comments don’t get messed up, and there should be any problem, for instance, with the adwords plugin.

There are two versions: Textile 2.6 and Textile 2.6 for beautifiers ... the “for beautifiers” version is what I’m using, it removes Textile’s clean-up of <code> sections, so that I can use GeshiSyntaxColorer

Just for a cool example of the neat stuff:

The following textile code:

"Check out this page":1 for a nice place to test your Textile skills.

The image below shows a photo from "my flickr page":2

!4!:3

[1]http://textism.com/tools/textile/index.html
[2]http://flickr.com/photos/jaykul/l
[3]http://flickr.com/photos/jaykul/48483236/
[4]http://static.flickr.com/28/48483236_f9d5d11b99_m.jpg

Would reproduce like this:

Check out this page for a nice place to test your Textile skills.

The image below shows a photo from my flickr page

42 Comments

  1. Hello,

    I installed your textile 2.6 plugin and like it so far. However, I’ve got a problem with inserting Amazon images. I’ve got a code snipet like this:

    !1!:2

     [1] http://images.amazon.com/images/P/B000AJJNFE.01.&#95;SCMZZZZZZZ&#95;.jpg
     [2] http://www.amazon.com/gp/redirect.html..blah..blah..blah..blah

    < < snip >>
    The result is that the serial number in the first link gets screwed up by textile and turned into an < em > block, and nothing works after that.

    In your Flickr example, I would expect the same behavior with the underscores becoming blocks. Got any idea what’s going on?

    Thursday, October 20, 2005 at 4:20 pm | Permalink
  2. Jaykul wrote:

    Well, the simplest answer to Patrick’s problem is to change the _ to a &amp;#95; which textile will pretty much ignore, but which will render properly in the image.

    The complicated answer is that you should go to http://textism.com/tools/textile/ and post a bug to Dean ;)

    Friday, October 21, 2005 at 10:39 am | Permalink
  3. asd wrote:

    textile2.6 cannot supoort chinese character
    when i put star around chinese word(ex: a????? )
    it has no effect

    Sunday, October 23, 2005 at 2:45 pm | Permalink
  4. This plugin produces invalid HTML when used with blockquote, as discussed in this WordPress Support Forum thread. Basically, it should not wrap the tag inside tags, since it ends up overlapping tags if there are multiple paragraphs inside the blockquote. You end up with: !!! It would be great if this could be fixed, since some people on a group blog I manage depend on your plugin!

    Wednesday, November 9, 2005 at 10:43 am | Permalink
  5. Ugh. That didn’t come out right:

    No This plugin produces invalid HTML when used with blockquote, as discussed inthis WordPress Support Forum thread:

    http://wordpress.org/support/topic/19587

    Basically, it should not wrap the blockquote tag inside p tags, since it ends up overlapping tags if there are multiple paragraphs inside the blockquote. You end up with: p-blockquote-/p!!! It would be great if this could be fixed, since some people on a group blog I manage depend on your plugin!

    Wednesday, November 9, 2005 at 11:07 am | Permalink
  6. Jaykul wrote:

    If you’re using textile … you should be using “bq. “ at the begginning of the line for blockquotes, not the blockquote tag …

    You can use xhtml while using textile, but you need to take into account that you are using textile. Which is to say: if you leave a blank line, textile is going to start a new paragraph for you, unless you’re in a notextile block — which does weird things converting everything to code blocks— so to accommodate the fact that your are using textile, you need to put a leading space on the line if you’re starting a block-level xhtml tag after blank lines … or use textile markup.

    For example, this blockquote was put in using the bq. textile markup.
    It breaks on lines like a pre section, but you can use XHTML inside it, or the usual textile markup.

    Now, here’s some normal text, and we’ll break for a new paragraph.

    Lastly, I’ve got a simple blockquote tag with a space in front of it …

    This is that simple blockquote tag with a space in front of it that they mentioned in the textpattern wiki.
    Again, you can use textile markup or XHTML...

    So, I guess I’m not sure what else to say.

    Friday, November 11, 2005 at 1:23 pm | Permalink
  7. Clemens wrote:

    as far as i can see, textile2.6beauty breaks the more-teaser-separator by enclosing it in del-tags. probably breaks other html comments, too. in the preq in function span (line 508 in my version), i replaced
    ($f)
    with
    (?&lt;!&lt;!-)($f)

    Saturday, November 12, 2005 at 1:32 pm | Permalink
  8. Jaykul wrote:

    Hmm… it should leave html alone, I’ll have to check that one out.

    Monday, November 21, 2005 at 12:02 am | Permalink
  9. Nick Curry wrote:

    it seems the img tag gets garbled if an alignement = indicator is added. To fix, replace image and fImage functions with the following:

    // ——————————————————————————————-
    function image($text)
    {
    return preg_replace_callback(”/
    \! # opening !
    #REPLACE THIS
    #(\)?
    #WITH THIS:
    ($this->hlgn) # optional alignment atts
    ($this->c) # optional style,class atts
    (?:\. )? # optional dot-space
    ([^\s(!]+) # presume this is the src
    \s? # optional space
    (?:\(([^\)]+)\))? # optional title
    \! # closing
    (?::(\S+))? # optional href
    (?=\s|$) # lookahead: space or end of string
    /Ux”, array(&$this, “fImage”), $text);
    }

    // ——————————————————————————————-
    function fImage($m)
    {
    //$this->dump($m);

    list(, $algn, $atts, $url) = $m;
    $atts = $this->pba($atts);
    /*
    REPLACE THIS
    $atts .= ($algn != ‘’) ? ‘ align=”’ . $this->iAlign($algn) . ‘”’ : ‘’;
    WITH THIS:
    */
    $atts .= (isset($m1)) ? ‘ align=”’ . $this->iAlign($m1) . ‘”’ : ‘ALIGNNOTFOUND-m0=’.$m1;

    $atts .= (isset($m4)) ? ‘ title=”’ . $m4 . ‘”’ : ‘’;
    $atts .= (isset($m4)) ? ‘ alt=”’ . $m4 . ‘”’ : ‘ alt=”“’;
    $size = @getimagesize($url);
    if ($size) $atts .= “ $size3“;

    $href = (isset($m5)) ? $this->checkRefs($m5) : ‘’;
    $url = $this->checkRefs($url);
    $out = array(
    ($href) ? ‘’ : ‘’,
    ‘’,
    ($href) ? ‘’ : ‘’
    );

    return join(’‘,$out);
    }

    // ——————————————————————————————-

    I hope this helps…

    Saturday, November 26, 2005 at 1:09 pm | Permalink
  10. Nick Curry wrote:

    hmmm, looks like the textile plugin garbled the above… the important bits are

    #REPLACE THIS
    #(\)?
    #WITH THIS:

    and

    /*
    REPLACE THIS
    $atts .= ($algn != a??a??) ? a?? align=a??a?? . $this->iAlign($algn) . a??a??a?? : a??a??;
    WITH THIS:

    */
    $atts .= (isset($m[1])) ? ' align="' . $this->iAlign($m[1]) . '"' : '';

    Saturday, November 26, 2005 at 1:13 pm | Permalink
  11. Michael wrote:

    Great plugin. I have been using it for a couple of weeks, and now I can’t live without it. Keep up the good work :-)

    Wednesday, November 30, 2005 at 10:37 am | Permalink
  12. Jim Jeffers wrote:

    Hey, when I use the 2.6b.php file the geshi code still gets turned into html. Any advice? Checkout my page to see what I mean.

    Friday, December 30, 2005 at 12:13 am | Permalink
  13. Jaykul wrote:

    The trick is the priority you assign to the plugins… for instance, if you look at my geshi plugin, you’ll see I have it set to priority 5 (the priority is the last number in the add_filter('the_content', 'GeshiSyntaxColorer', 5); command at the bottom of the file. And if you check my textile 2.6 plugin, you’ll see that I’ve set it to priority 6. This way seems to work for me ;)

    Saturday, December 31, 2005 at 12:20 pm | Permalink
  14. Kyle Rove wrote:

    I have found that punctuation after an abbreviation (i.e. ... USA, ... rest of my sentence) does not properly convert the textile markup to the abbr html element. Any possibility of fixing this?

    Sunday, January 8, 2006 at 1:46 pm | Permalink
  15. Kyle Rove wrote:

    never mind…. I guess it does here… :-p

    Sunday, January 8, 2006 at 1:46 pm | Permalink
  16. Paul Pehrson wrote:

    I’m wondering if in a future release you might consider allowing people to turn this off in WordPress on a post-by-post basis. Maybe there could be a custom field or something that allows you to turn off Textile for a specific post.

    I’m having trouble with WP2.0 putting double spaces between lines because I’m using the WP2.0 rich text editor. Is there something I should be doing to make it work with WP2.0?

    Tuesday, January 10, 2006 at 5:07 pm | Permalink
  17. Jaykul wrote:

    There’s a TextControl plugin that allows switching post-processors per-post … I’m not really planning on supporting that here … Honestly, if you’re using the rich-text editor, I don’t see any reason to use Textile on those posts, and I’m frankly rather frustrated with Matt and the WordPress team for putting the rich text editor in as default even though people are using Textile and Markdown and others — and can’t disable them, because the original WordPress design for these plugins was that they should leave the unprocessed text in the database.

    Friday, January 13, 2006 at 11:53 am | Permalink
  18. Jeremy wrote:

    Great plugin, I love it!!!

    I’m trying to push it a little further, to use it in titles and meta fields, and here’s where I’m running into a problem:

    Is there a way to keep Textile from adding p tags when the content is only one line long? Then I can hard-code a field to be a header, for example, without getting a nested p tag…

    Any help you could offer would be appreciated.

    Thanks!
    -Jeremy

    Monday, February 20, 2006 at 2:37 pm | Permalink
  19. Arne wrote:

    hi there,

    is there any chance to use the plugin without harming the function allowed_tags() (used in comments.php to show what html tags are allowed)? whenever i active the textile plugin, it strips away allowed_tags’ output.

    Wednesday, March 22, 2006 at 10:32 pm | Permalink
  20. Arne wrote:

    and another problem here… the contact form plugin doesnt work, also because of textile. isnt there a notextile-tag like in txp?

    Thursday, March 23, 2006 at 1:23 pm | Permalink
  21. Jaykul wrote:

    Jeremy: That’s a good question. I’m not 100% sure if this will do what you want, but you can try using the ‘lite’ version… You will see on lines 992-995 the function textile which calls TextileThis, and passes only one parameter. Make yourself a copy, call it textileLite and change the call to return $textile->TextileThis($string, true); … then, in your add_filter calls, use textileLite instead of textile.

    Arne: Look at the bottom of the file. Line 1008.
    Arne: Contact form plugin? It must be (inappropriately) calling a filter for ‘the_content’, ‘the_excerpt’, or ‘comment_text’ ...

    Sunday, March 26, 2006 at 4:42 pm | Permalink
  22. Arne wrote:

    thx, commenting out these two lines did it for me :-)
    @contact form plugin: well, i dont know anything about wp’s plugin structure, so i dont know in which way i could change the plugin. i only can see that you’re right: it’s calling a filter for “the_content”.

    thats the plugin: http://johannesries.de/webwork/contactform/

    Sunday, March 26, 2006 at 5:18 pm | Permalink
  23. Whisper wrote:

    I installed your plugin on one of my blogs that I share with some family members. After they played with it and decided they would rather just use the rich text editor I uninstalled it (deactivated it and deleted the file) Now I have a problem. The rich text editor is gone, everyone has the option enabled in their profile, it’s also enabled on the Options page, but it will not load on the “Write” pages. I have looked everywhere I can think of even in the DB and cleared my cache folder too. I cannot find whats causing this and the last thing that happened right before it disappeared was the instalation of Textile. Can you help me please :)

    BTW I do have this installed on MY blog and I LOVE it thank you so much. Though I wish I could get mine to work with Geshi like you did, but no biggie I would so rather have Textile than Geshi. Beautiful plugin now if only my family would understand how nice it is :P

    Tuesday, April 18, 2006 at 1:49 pm | Permalink
  24. Whisper wrote:

    I must sincerely appologize. It was not Textile at all that was messing with TinyMCE it was in fact another plugin. Apparently it took it a little while to kick in though sigh . I am so sorry for my assumption. So the TinyMCE problem is solved ;) again I’m sorry.

    Tuesday, April 18, 2006 at 3:56 pm | Permalink
  25. Whisper wrote:

    OK I hate being annoying but after very close look at the files (textile2b and geshi) I found out why it wasn’t working.

    In your textile2b file it says this around line 812:
    /* when using a code beautifire, we don't want this between code tags - Joel
    NOTICE: this will (still) break if you use both: */
    $offtags = ('pre.*|kbd.*|notextile');

    and in the geshi file (geshi.php) around line 116:
    var $header_type = GESHI_HEADER_PRE; // The type of header to use

    That variable needs to be set to GESHI_HEADER_DIV knocks self on head
    I can’t believe how long it was staring at me. Geshi was putting pre inside the within code so it was breaking it. So yeah this will fix the problem for those that wanna use Geshi ;)

    (BTW you can delete my previous posts I won’t be offended and this little aside too :* )

    Tuesday, April 18, 2006 at 6:36 pm | Permalink
  26. Jim wrote:

    I love this plugin, but I’ve discovered that this recent version breaks the WordPress ability to use quicktags. Do you have a workaround solution for this?

    Monday, May 1, 2006 at 12:41 pm | Permalink
  27. Jaykul wrote:

    What on earth do you mean? The quicktags are just little javascripts that insert html tags. There’s nothing in Textile that affects them … in fact, I just tried it and they work fine. Or are you talking about tags in the COMMENTS? They’re disabled by default, but you can see in the comments above how to to enable them again.

    Wednesday, May 3, 2006 at 11:29 pm | Permalink
  28. Jim wrote:

    I have a contact form plugin that I use. The plugin requires a quicktag () to be inserted into a page in order for the contact form to appear. When I upgraded from Textile1 to Textile2, my quicktags suddenly stopped working. I even turned Textile2 off for a moment to verify that it was, indeed, the thing that was breaking the quicktags. The nearest I can figure is that Textile sees the dashes before and after the quicktag and tries to convert them into formatted text.

    Thursday, May 4, 2006 at 2:06 pm | Permalink
  29. Jim wrote:

    Hmm, and I’m noticing that it did it here, as well – removed the

    Thursday, May 4, 2006 at 2:11 pm | Permalink
  30. Jim wrote:

    left arrow, exclamation point, dash, dash from the left side and one dash from the right side of the quicktag, which essentially renders it useless. I had the same problem when testing it on the textism site. Dunno if it’s something I’m doing wrong or a bug in the system…. Any help you can provide would be greatly appreciated. You can see what it’s doing to my contact form here.

    Thursday, May 4, 2006 at 2:20 pm | Permalink
  31. When doing this:

    * "Some text":http://www.example.com
    Text on a new line.
    * "Some more text":http://www.foo.bar
    More text on a new line

    the list isn’t closed (the last and are missing). It seems having text on a separate line (using double space after the link) breaks something. Is this something you can fix?

    Thanks for a great plugin!

    Saturday, May 13, 2006 at 3:53 pm | Permalink
  32. Paul wrote:

    Questions: I started using the latest Textile 2 plugin and then started using FeedBurner so I could publish summaries of the weblog entries on another site. FeedBurner is including the Textile markup in the feed data. I’m guessing this is because WP 2 is responding to feed requests straight from the database so the markup never goes through the textile plugin to get converted on its way to FeedBurner. Is this right? If so, is there a way to fix it?

    Saturday, May 13, 2006 at 6:35 pm | Permalink
  33. Jaykul wrote:

    PA?l: You should probably submit that to the author of textile itself, through his testing and bug-reporting page, here.

    Paul: You can parse your feeds (I just don’t think RSS should have HTML embedded in it). Just uncomment the next-to-last line in the plugin: // add_filter('the_excerpt_rss', 'textile', 6); (that is, delete the slashes at the front so it just looks like: add_filter('the_excerpt_rss', 'textile', 6);).

    Saturday, May 13, 2006 at 7:56 pm | Permalink
  34. Paul wrote:

    Thanks. I finally figured out that the marked up text that was showing up in the feed was coming from text in the WP2 “excerpt” entry area. I don’t remember putting it there, but there it was anyway. I removed that (which as I understand was overriding what WP2 would normally provide the feed as a post excerpt) and things are back to normal. I agree with you about HTML not being in RSS. I was confused about where the markup was coming from and just figured that WP2 normally stripped the HTML out but didn’t recognize the textile markup as such and left it alone. Anyway, thanks for the quick reply (and the plugin!) — much appreciated.

    Saturday, May 13, 2006 at 9:02 pm | Permalink
  35. Matt wrote:

    I installed your plugin – thanks, I love Textile2! I got fed up with the default WordPress editor because it kept messing up my pre tags, and now I’m glad I started looking for a replacement. This is a much more sensible way to create content than hand-coding HTML! :-)

    Sunday, May 14, 2006 at 12:59 pm | Permalink
  36. @Jaykul: Thanks, I will.

    Monday, May 15, 2006 at 4:35 pm | Permalink
  37. Jon Zuck wrote:

    I’m having trouble with Textile plugins since I upgraded to WordPress 2.0.3. It seems all the plugins, (including 2.6) seem to start all posts with two beginning paragraph tags, and end with two closing p tags. This is driving me crazy. Am I doing something wrong? Please help. Thanks

    Sunday, June 11, 2006 at 4:31 am | Permalink
  38. Jon Zuck wrote:

    Disregard my last post… I got that problem fixed. I REALLY like Textile 2.6, but there’s just one thing that’s not working for me. I give my external links a class, e.g.

    (ext)This link

    Textile 2.6 seems to recognize classes on spans and block-level elements only. Is there any way I can get it to recognize classes on my links? Thanks for your help.

    Sunday, June 11, 2006 at 11:47 am | Permalink
  39. Jon Boyd wrote:

    I also have a problem, which I’ve noticed only since WP 2.0.3 (so it’s easy to blame the upgrade): editing a comment with single quotes in it turns the single quotes into backslash-single-quotes. (That is, \’ )

    Submitting the original comment works fine, and they work fine in posts — it’s only when editing a comment that this seems to happen.

    Can you advise us whether this is a bug in WP or in Textile 2.6 Beta?

    Tuesday, June 13, 2006 at 5:02 pm | Permalink
  40. I just installed textile. I guess I just don’t get it. Nothing appears different in my editing box. What am I supposed to see. I have not found any installation instructions. Maybe I am missing something.

    Tuesday, July 4, 2006 at 12:50 pm | Permalink
  41. g wrote:

    Man! I love you!!! Textules!!!!!

    sorty, meant to say Textile Rules!!!!!!!!

    Saturday, August 12, 2006 at 12:25 am | Permalink
  42. Jeremy Helms wrote:

    You can use xhtml while using textile, but you need to take into account that you are using textile. Which is to say: if you leave a blank line, textile is going to start a new paragraph for you…

    For those who aren’t familiar with authoring WordPress plugins, you can easily alter the main textile() function [which WordPress calls for rendering text into textile output] so that it will not take action unless the post being displayed has a custom field value specifying to do so.

    Simply replace the textile() function inside textileWrapperForWordPress.php with the following code block. Then, for the posts you want to be rendered with textile, you’ll need a custom field named “mime_type” that has the value of “textile” and viola, you’ve got textile output for that post only and your other posts aren’t affected.

    function textile( $string=’‘ ) {
    global $post;
    $mime = get_post_meta($post->ID, ‘mime_type’, true);

    if (isset($mime) && $mime == ‘textile’) :
    $textile = new Textile;
    return $textile->TextileThis($string, false, false, false, false);
    else :
    return $string;
    endif;
    }

    Wednesday, March 28, 2007 at 12:37 am | Permalink

11 Trackbacks/Pingbacks

  1. [...] a??a??Textile Plugini??c??a?????c? a??a??c??cs?html? ?c??i??c??a??e??a??e??a??c??cs?BBcodei??2.6e?Sa??a?? by Scott | posted in WordPress Plugins Trackback URL | Comment RSS Feed Tag at del.icio.us | Incoming links [...]

  2. [...] Update: I’ve just installed Textile 2.6 Beta. The thumbnail no longer works even on the Front Page. Could you suggest any remedy? [...]

  3. [...] Textile2.6b [1] http://blog.firetree.net/2005/08/25/viewlevel-20/ [2] http://www.huddledmasses.org/2005/10/03/textile-plugin-26-released/ [...]

  4. test : Textile cheat sheet on Tuesday, November 29, 2005 at 4:00 pm

    [...] The default Wordpress installation includes the textile1 plugin, although I recommend installing the latest and greatest textile2 plugin from Jaykul. Textile2 adds lots of new features and allows you to move ugly URLs out of your code, and reference them by number at the end. [...]

  5. noentry.org : Textile cheat sheet on Wednesday, November 30, 2005 at 8:54 am

    [...] The default Wordpress installation includes the textile1 plugin, although I recommend installing the latest and greatest textile2 plugin from Jaykul. Textile2 adds a lot of new features and allows you to move ugly URLs out of your code, and reference them by number at the end. [...]

  6. OMG I’m onFiar! » Blog Archive » Domains on Wednesday, November 30, 2005 at 3:00 pm

    [...] Another note: Textile 2.6 is ace. [...]

  7. DontTrustThisGuy.com » Transition to Dreamhost. on Friday, December 30, 2005 at 12:53 pm

    [...] Transition to Dreamhost. December 29, 2005 Well now all of my current sites are hosted on Dreamhost. The only way to go from here is to get my own box later on down the road. Since I had to upload some files all over again I figured I’d install a new version of the textile 2.6 plugin that allowed support for the Geshi syntax highlighting engine. Let’s do a quick test to see if it worked.   def hello puts “hello world” end   3.times do hello Tags [...]

  8. IMHO » Blog Archive » ??N?N????????????? WordPress on Tuesday, January 17, 2006 at 2:33 pm

    [...] ????N? N??????? N?N?????N? ??N?N?N? “?? N???N?” N?N?N???N?N???N?NZN? ????????????N? “N?????????N??????? ???????? N???N?N???” N? N?N???????NZ Textile Plugin 2.6 ??????N?N? ?????????? ??N???N?N???N?N? N?????N? “?????? N?N??? N?????N???N?”: http://www.textism.com/tools/textile/ [...]

  9. Definitely Maybe :: Textile Powered on Tuesday, February 7, 2006 at 4:00 pm

    [...] Hasta hace poco estaba utilizando la versión 2.6 de Huddled Masses que implementa las funciones básicas de Textile y algún que otro detalle, pero nada muy avanzado. Sin embargo, es totalemnte funcional y alcanza para un blog normal. [...]

  10. Actual World » Textile on Tuesday, June 6, 2006 at 4:55 am

    [...] Sencillo, A?no? Pues si te animas, para Wordpress hay varios plugins. Estuve probando unos cuantos y el que mA?s me convenciA? fue el de Huddled Masses que encontrA? a travA?s de yukei.net puesto que otros que habA?a probado me creaban el mismo problema que a A?l: me estropeaba el cA?digo y lo hacA?a ilegible. [...]

  11. ninthspace » Double equals and Textile on Sunday, September 3, 2006 at 7:38 am

    [...] First an upgrade to Textile 2.6 was in order, followed by sticking stupid double equals signs around everything. But then, because Textile thinks double equals is a tag for no textile, the double equals in the code gets stripped out. [...]