Well, the code that I have for Textile 2.0 is actually marked “beta” but it works great. In fact, it’s what I use to do all the formatting of posts for my site (including the comments – hint, hint [;-)]). At any rate, it is what Dean Allen calls “a Humane Text Generator.” It’s purpose is to allow you to do some formatting of your posts without having to learn HTML at all.
That is, you put asterisks (*) on either side of a word for strong text, and underscores (_) for emphasis, and so on. You can play with how it works on Dean’s test site for textile and if you want the WordPress textile plugin, you can get it here... I also made a plugin of the older version, at Matt’s request, so here is the textile 1.o plugin
As a side note… this plugin completely disables WordPress’s built in “texturize” plugin. Not doing so results in a mishmash of ampersands and garbage that practically always results in random links and completely illegible posts.
Edit 3-May-2005] I just noticed I’m using a slightly updated version that I haven’t linked before (all I did was make some changes that make Beautifier work a little better), but just to be sure, here are my 2.5 changes
Edit 3-Oct-2005] Another release by Dean Allen in his blogging tool TextPattern 4.0 has prompted me to make another release too. Supposedly minor changes, but … it should improve block handling and the ‘notextile’ tag (or double equals) works, as evidenced by *this text* not being _marked up_. 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
[...] [...]
hi,
can’t seem to get it to work… i put it in the my-hacks.php file and get back this “Fatal error: Call to undefined function: remove_filter() in /home/bright/public_html/bwp/my-hacks.php on line 389” when going back to any page in the admin… so for now i’ve deleted the entry in the my-hacks.. thanks brian
It’s not a “hack” it’s a plugin. It’s designed to work with WordPress 1.2+
I’ve activated the textile 2.0 plugin, and it works, but not for feeds (atom/rss). How do i enable it for feeds?
Ah, yes. If you want to filter your RSS feeds you need to add a filter for them … from what I can tell in the beta I’m running, it should work automatically if you use “Full Content” in your RSS feeds, but not at all with excerpts because there’s no hook in the rss excerpt code that I have. I’ll upgrade to the latest 1.2 version and let you know.
So … I upgraded to the latest nightly (May 24 – post Mingus) and sure enough, there’s a hook for the rss feeds. You could just add a line to the bottom of the textile2 plugin (you can edit it in the “Templates” section of your WP control panel):
add_filter(‘the_excerpt_rss’, ‘textile’, 6);
However, I wouldn’t do that, myself. The excerpt is put into the rss “description” tag, which really ought not to have HTML in it, IMHO [;)]
So, I have a ton of HTML posts that I just imported from MT. If I turn the WP Textile plugin on (for using in new posts), it munges the HTML. Is there a way to tell the plugin to exit early if it encounters HTML — or skip over any pre-existing HTML tags?
Hrm… Well … the majority of that code is not mine, obviously, it’s from Dean Allen … the only thing I can think of would be to wrap your existing code in <notextile> tags, which is supposed to make it not process it.
The problem is that Textile allows HTML code through, but it still wraps everything in <p> tags wherever there’s a blank line. [:(] I’m not sure if there’s anything you can do about it … I suppose it’s possible, if the <notextile> solution works, that a script could be written to put that on all your existing posts…
Well, here’s one for you: I’m using your textile plugin for my site. I have a post, containing this:
1)
<> !*’‘#
^”`$$-
!*=@$_
%*<> ~#4
&[]../
|{,,SYSTEM HALTED
2)
^<
<.*}”_# |
-@$&/_%
!( @|=>
;`+$?^?
,#”~|)^G
What I get when I attempt to save this, whether I enclose it in tags or no, is
Fatal error: Call to undefined function: detextile() in /homepages/33/d89062730/htdocs/wp-content/plugins/textile2.php on line 476
Any ideas?
I’ve big pb with you plug-in … when turned on, all character (French ISO-8859-1) are not showed ….
An alternantive ??
Well, I’m trying the version that’s currently in TextPattern (the blogging software by Dean Allen) ... it doesn’t have the detextile, so you shouldn’t have that problem Chris, maybe you could try upgrading? What version does your plugins page say? (My current copy is 2.4 Beta).
As far as French … I don’t really know what it’s doing to your characters … do you have a sample? Can you try putting a few of them in here?
I don’t want to get into a whole debate about how to specify language tags, but Dean Allen is French …so it seems like it should work [;)]
Like Chris, I’m having the “Fatal error: Call to undefined function: detextile()” problem as well. However, it’s only showing up on my localhost installation (on Windows), not on my web install. Perhaps it’s a difference between the PHP installs on the two machines, forcing different paths in the code?
Never mind. I had imported my MovableType blog, where I used Brad Choate’s MT-Textile 2.0 and MT-CodeBeautifier plug-ins in some entries. WP isn’t wild about some MT-Textile stuff, and it really doesn’t like MT-CodeBeautifier. Once I stripped those out, things perked up nicely. I haven’t debugged it, but I suspect the culprit was lines like “@[php]echo(‘foo’); @”.
I just moved over from MT to WordPress, and was really glad when I noticed that there is a Textile2 plug-in for WordPress. I used Brad Choate’s Textile2 for MT and was very pleased with it. Thank you for writing this plug-in!
After spending a couple of nights getting the blog to work correctly I noticed that there are some parts of Textile2 that are not implemented in your plug-in. The one which I have been using the most is block alignment and indent (characters < , >, =, <>, ) and (). Do you intend to support them? In my opinion they are pretty useful.
Have you found a solution for french characters not showing ? I try textpattern : no textile problem with exactly the same code as this plugin. So the problem seems to be in the way the filter is called ???
Thanks …
I have problems getting these Norwegian charaters to work properly:
Test lower case: A? (ae) A? (oe) A? (aa)
Upper case: A? (AE) A? (OE) A? (AA)
When running Textile2 my “special” characters don’t show up in the post, but tthe heading are still ok.
What about the norwegian characters A?A?A? and A?A?A??
It seems like the plugin ignores words with this characters.
I’ve discovered a bit of a bug in Textile (this is on the WP plugin for 1, but assume it’s there for 2 as well). If a commenter leaves three exclamation marks (or more) in a row, it creates a bunch of dead img links thus (spaced to appear here):
The result is a bunch of dead links throughout comments. Seems likely that commenters would add such things (Cool!!!) etc., so the choice of ! as a bounding tag for imageurl was not a good one.
I tried hacking the code, but I’m not clear which other characters are allowable and not reserved in php, etc., for other things.
Any ideas how to fix this?
If nothing else, could you tell me which lines to comment out in textile1.php to lose the
conversion, which I don’t use otherwise? Thanks…
First of all, I love the plugin. Thanks!
Second, I found a bug… successive posts on the front page of a Wordpress that use the footnote1 markup all use the same tag on the anchor (#fn1). This means that earlier posts (further down the page) have footnotes that point to the first #fn1 anchor. Maybe the anchor should reflect the slug for the post or a GUID or something?
1 I really like footnotes.
P.S. “SEO Expert” (#comment-858 on this page) is obviously just a Google bomber, trying to get that term linked to his web site.
You certainly deserve thanks for making and hosting the Textile plug-in, but his one word comment is contentless; all he wants is the link back to his site. You should delete his comment. Bastard comment spammers!
Everyone with foreign letter problems: your letters seem to appear fine here?
Gary: I’m not clear about the !!!!! thing … it’s not happening on my blog, so I don’t know what to tell you. However: To turn off images: convert the function textile around line 947 of the 2.4 plugin to this:
$textile = new Textile;
return $textile->TextileThis($string, $noimage=true);
}
David: Well, I don’t quite see your problem2 either. You just put the square brackets around the number, and it makes a footnote to that number. Seems to be working here on my page?
I just noticed I’m using a slightly different version (all I did was make some changes that make Beautifier work a little better), but just to be sure, I’m linking it in the main article above.
Oh, and one last thing … Crazy Bob (aka SEO Expert) isn’t an SEO Expert or a Google bomber. He’s actually something of a Google spoiler … as you’ll see if you click through his link. [laughing]
2 In other words, not a problem for me.
There’s a small bug in the
tag handling regular expression that causes it to fail to parse markup like !{class:value} /image/url!
If you change the expression to include \s* between the “optional dot-space” expression and the “presume this is the src” expression, these are parsed correctly.
I think the use of all the non-hungry expressions is the cause. Having at least one “semi-hungry” expression helps anchor the others.
In the previous comment, “tag handling” should be “image handling” and “s*” should be backslash-ess-star.
OH MY GOD!
I spent like 30 mins trying to figure out why the plugins wouldn’t work (since I couldn’t find them at the textile SITE! I found them here… only to discover that the files are all formatted in HTML!!!! WHYYYYYYYY
So I copied the code from the rendered html into a text file and now it should work fine
Just thought you should either provide a raw text version, and/or point out the fact that these files are not just plain ol’ php files… (i just “save file to disk“ed them…)
Thanks for providing the files though!
Cheers
Oh! And the 1.0 Version link above just goes to the 2.5 file
I tried Textile plugin 2.5 beta, and it works quite well. But I see this plugin alters HTML tags severly:
For example, a href=“test__program_screenshots.jpg” is translated a href=”_programscreenshots.jpg (‘em’ tags in attributes!
)
I hope this issue is fixed soon.
Thanks.
Hi
First of all: Thanks for taking the effort of making this plugin
I just played around with it a little bit (after I’ve become used to Textile thanks to instiki) and found a small problem with it. In the block function when you try to determine if the current line starts a pre-block or not, you only accept pres without arguments.
-437,7 +437,7array_push($text, “ “);
foreach($text as $line) { – if (preg_match(’//i’, $line)) {
+ if (preg_match(’//i’, $line)) {
$pre = true;
}
Sorry, another thing: Could it be that your span, code etc. functions basically ignore the notextile blocks? I mean, if you do something like
*hello*
“hello” is still strong
Whoops, better comment on the updated entrya??
Thanks for writing this plugin. I’m writing to note an issue i’m seeing with text I marked up with Textile for use in my MT blog which I’m importing into Wordpress.
It seems that the Textile2.5 plugin fails to create a block quote when the first thing following it is a textile encoded link:
bq. "Wordpress":http://www.wordpress.org
Also appearantly the MT plugin has some innovations like extended blocks, that I found really handy. I could enter =bq..= and it would blockquote everything until the next block idenfitier (usually a p.). It would be very cool to be able to use this in Wordpress too.
Hmm, I’m not so sure I’m right about what’s causing the blockquote to fail.
Well, the plugin is great, but using “
“ to designate deleted text (the strike tag i.e.) messed up my import from blogger. Every post that had a minus in it was suddenly striked through, you can imagine my surprise when I first noticed it. ;)Anyway, is it possible to turn that one feature off (possibly “+”, too, because I might want to use a + in my texts sooner or later…
Which leads me to the question: If I use Textile, I can’t post mathematical content, right?
I’ve finally gotten around to adding a “download” link to my source script. All of my plugins should be simple and easy to download now, just click through to the source and hit the download link.
Hopefully that will solve all the download problems people have had.
I’d like to congratulate you on a fantastic plugin for WordPress. I’m still very new to WP but this plugin makes it a lot easier to use.
However, I’m having some extreme difficulty with escaping. I use the AdSense Deluxe plugin, and this uses tags in the form of an HTML comment (< !–- comment -->) to insert a block of code (usually adsense code). For some reason though, no matter how I try to escape this small block, it will be textiled. If I leave out the escape characters then the first four characters vanish (the left tag, exclam. mark and the two dashes). If I surround it with escapes then I get
tags instead, with the whole comment showing. Neither shows an advertThis didn’t happen in Textile1, but I need 2’s functionality because 1 was being a pain wrapping p tags around everything. Can anybody help?
It appears that came out hopelessly wrong. You know what I mean with an HTML comment right? TIA.
You mean one of < !-- these -- >, but, as far as I know (and this is being parsed by Textile, as you can tell), there’s nothing preventing you from putting comments in your page.
Try viewing the source of this page. There should be two comments, one on either side of the bold “comments” above. You can also look at the post I made for the recent Textile 2.6 release, there’s a comment right in the main post that says “there’s a Jaykul comment here” so I’m sure it’s not Textile stripping it out…
Which version did you grab?
To reply to the question about math: – and + work fine, as long as there’s a space on either side of them. You could turn that feature off fairly simply: edit the file, go to the “fSpan” function and remove the line(s) defining them:
'-' => 'del',and'+' => 'ins',About the block quote, I’m not sure why it doesn’t work in that spot, but I have no intentions of adding features to Dean’s Textile parser, I want to keep them the same so that people can trust his documentation. The best bet is to raise this question on his blog or textpattern support forums
The
< notextile >blocks, and double = blocks work now, too (in 2.6) so I think most of the problems have been cleaned up.Thanks for the reply Jaykul.
I just updated to 2.6 and I’m making some progress: now if I use the notextile tag the whole part appears, but textile is still doing something since it’s changing the to HTML chracters (of the & number ; type). I can understand your plugin isn’t at fault, it appears to be a problem with the generator code, but it’s a little frustrating. Feel free to email me if you rather wouldn’t post a huge discussion in your comments page
Once again, thanks for your help so far.
To show what I mean, type the following into the Textile generator:
inside a <b> tag
lots of code ought to be able to go here
emphasized and strong, and all sorts of stuff.
The idea is that *stars* should stay *stars* and _underscores_ too!
Hypothetically, this ought to be in a span tag.==
I’ve sent a bug report from that page to Dean Allen.
Looks like the
==notextile==stuff is acting like hiscodeblocks used to. Ugh. You think he’d take my fixes if I could figure this out?I’ve installed your Textile 2.6 plugin and also the GeSHi plugin. For some reason when I write:
print (“Hello World”);
I see the pure HTML tags for the syntax highlighting. WordPress is not rendering the HTML for some reason.
I have the same problem as you James, from what i can guess the Textile plugin is getting the html after the GeSHi plugin colours it, then Textile converts the html into entities.
i tried using a Textile plugin that skipped over pre tags (what i was using to contain the source code) but it was just messing it up even more (wrapping the pre tags in another set of pre tags, then just generally messing with the html)
at the moment i have just disabled the source highlighting until i can find a working configuration.
If you use the “For Beautifiers” version, and set the priority of Geshi higher than that of Textile, you shouldn’t have any problems, although I seem to be getting an extra < br />. Of course, only I can get < code > (or anything else that looks like HTML) into these pages, so let me show by example:
Perl:
print $foo;
Html
<p>This is a paragraph with a <b>bold</b> word in it.</p>
<p>This is another paragraph with an <em>emphasized</em> word in it.</p>
</div>
There seems to be a bug with parsing link attributes. In this example, the link should have ‘oops’ as a class attribute. Instead, the parenthesised ‘oops’ appears as part of the link text.
link attribute test: (oops)link text
I think you mean to put “link text(oops)” which works like: link text
Jaykul, Tom is right. The plugin is not parsing class attributes correctly. “link text(oop)” would give a TITLE attribute of “oops.” Parentheses coming before the text should give a CLASS of “oops.”
I assign an “ext” class to all my external links. The parser bug is most frustrating.
I see what you mean … I think you will find that none of the attributes work on links in Textile at all (test here). Which is to say: this is not a problem with my plugin, which is merely a wrapper, it’s the way the Textile parser works. I am not usually prepared to alter the parser, since IMHO, these pseudo-markup languages are only useful when they work the same way everywhere…
PLEASE feel free to file bug reports:
http://www.textism.com/tools/textile/index.php
Great plugin I love textile! Hey, so performance-wise how does this fare? Is a cached version of the html stored in the database or is it generated each time someone visits the article?
It does not cache the output — there are already many plugins for caching full WordPress pages, and having the Textile plugin cache it’s output separately would mean storing two full copies of the article (in each markup: Textile and Html) so that you could edit it — because nobody’s ever gotten Html->to->Textile conversion working satisfactorily.
It does not cache the output — there are already many plugins for caching full WordPress pages, and having the Textile plugin cache it’s output separately would mean storing two full copies of the article (in each markup: Textile and Html) so that you could edit it — because nobody’s ever gotten Html->to->Textile conversion working satisfactorily.
Hey Joel, does this plugin store a cache version of the HTML. Or does it convert the textile page to HTML on the fly each time someone visits the page?
I don't see anything wrong with storing two files — memory is cheap, speed and performance, on the other hand, are not. (Ex: my host gives me unlimited storage but temporarily takes me down if my site overwhelms their servers. In any case, we're talking about text files, so storing a second copy is not significant.)
The real problem Joel is dynamically creating the html each time someone visits a page. That slows down your site (specially on a cheap host). Plus, if you ever get any decent traffic (say from digg), that'll kill you…
I'm not really familiar with the cache plugins on wordpress —- but if I recall correctly, (at least on drupal), you don't enable them all the time because your site lags with changes you make. That's why the drupal textile plugin keeps a cache copy of the html. The result is that regardless of whether or not the cache is enabled, textile does NOT slow down your site…
I use WPSuperCache, and haven't had any problems with the site lagging with changes, as far as I know … honestly, I don't have any problem with the concept of storing both copies.
When I wrote this I couldn't think of a way to store the two copies and have the front end show one version and the back end show the other. I can think of a way now… maybe I'll recode it after all