ryan Posted November 16, 2011 Share Posted November 16, 2011 (edited) Today I needed to install the latest Textile on an older site for a client, and figured I would go ahead and make a PW2 module out of it at the same time. Textile is the markdown language included with Textpattern CMS and apparently also used by Basecamp and Google+ to some extent. More information about Textile and syntax here: http://en.wikipedia....kup_language%29Textile is very similar to Markdown (already included with PW), though now that I've spent some time with the syntax, I think I might like Textile a little more.To InstallDownload or clone from GitHub at: https://github.com/r...ormatterTextilePlace files in /site/modules/TextformatterTextile/. Go to Modules in the admin, 'Check for new modules' and click install for Textile under the Textformatter section.You'll also see 'Textile Restricted' and that is a separate version of the module that may be used with untrusted input like user-supplied input or blog comments. The regular Textile should only be used with trusted input.To useAdd this to any textarea (or text) field, and that field will interpret Textile codes and output XHTML markup on the front end of your site. Note that Textformatters appear on the 'Details' tab of the field editor when editing a text or textarea field. Use the regular 'Textile' unless the field in question may contain untrusted user input, in which case you should use 'Textile Restricted'.Please noteDon't use this in combination with other text formatters like Markdown. Don't use with TinyMCE (there would be no point). This module may be used with any version of ProcessWire: 2.0, 2.1 or 2.2+. Edited April 30, 2014 by netcarver Updated github link to point to active repository. 2 Link to comment Share on other sites More sharing options...
apeisa Posted November 16, 2011 Share Posted November 16, 2011 Great job! I have never really used either of those (markdown or textile), but I was thinking about markdown on my discussions module. Now I have more options to choose from Link to comment Share on other sites More sharing options...
martinluff Posted November 18, 2011 Share Posted November 18, 2011 Useful addition, not least of all just because Textile has a big following; I used Textpattern a fair bit at one point and still loosely involved in a project that runs 100+ copies of it... Wasn't sure why you'd want to use something like Textile when I first used it but warmed to it later and still use it to run a decent-sized ExpressionEngine site in which I used Textile for all the text boxes in the admin. Takes a little to bring a client up to speed but then much less likely for them to accidentally trash the site or produce HTML spaghetti than if using TinyMCE/CKEditor etc. also I think it's quite useful at times for a client to realise they're not just generating a word processing document but are creating web markup in the background; and by default Textile has some nice tweaks to text formatting like 'proper' quotes, em and en dashes etc. and, as you say, the syntax is quite good. On the other hand it is another proprietary markup language... I think in a CMS admin it can sometimes also make more sense to clients since you're often re-using the same content in different contexts throughout a site and so 'WYSIWYG' is never really going to be a good analogy to try and fit since an individual chunk of content can look quite different in each context; in this respect I think Textpattern's more 'abstract' approach to content fields actually seems to fit well. As an aside I noticed Textpattern seems to be enjoying a lot more activity of late and steadily moving towards their big new '5' release with a fully revised architecture after a couple of rocky years... Link to comment Share on other sites More sharing options...
ryan Posted November 18, 2011 Author Share Posted November 18, 2011 Great points Martin. I think that lightweight markup languages (LML) like Textile and Markdown are in a lot of cases better with clients. The resulting markup is so much cleaner and maintains that integrity long term. And results in reduced support burden down the road. Plus, it gets the client into thinking in semantic terms rather than trying to "design" in the rich text editor. Still, everyone seems to want rich text editors these days, so I don't fight it. But if it were up to me, we'd all be using Markdown, Textile and the like. There is a ton of overhead that goes with TinyMCE and the like, and I'm not even talking about bandwidth and speed. Link to comment Share on other sites More sharing options...
MarcC Posted November 18, 2011 Share Posted November 18, 2011 Your implementation of TinyMCE is pretty ideal though, Ryan. Major props for that. I used to use WYSIWYG Pro and just let clients have the kitchen sink--embedded media, whatever. I found that it can result in a lot of wasted time during redesigns, so I headed toward Textile, but after trying PW's TinyMCE, I'm actually using TinyMCE as the main editor with some Textpattern sites I do. Link to comment Share on other sites More sharing options...
Soma Posted November 19, 2011 Share Posted November 19, 2011 Thanks Ryan for the module. I already was wondereing what's about these textformaters, as I didn't really get into these until now , I know they exist but will maybe give it a try. I always thought they're too complicated and not intuitive for clients to use. But maybe I'm wrong. I would love to hear experiences from others using it. I know it can make sense regarding the issues caused by wysiwygs. But if you know your way around in one of those you can pretty much configure it to your needs and restrict all things that could make troubles, but still it can be buggy in certain situations and inconstistent in different browsers. While a simple textarea you can't go wrong except not knowing how the markup tags work or make an error there, wouldn't it be possible or make sense to have a preview or a validator? Link to comment Share on other sites More sharing options...
MarcC Posted November 19, 2011 Share Posted November 19, 2011 Soma, I always make sure my Textile-using clients have a link to this nearby: http://labs.metanation.com/human-textile-reference/ Link to comment Share on other sites More sharing options...
diogo Posted November 20, 2011 Share Posted November 20, 2011 Soma, I used markdown on a website, and the client loved it and got the hang of it very quickly. I'm a Print Designer, and in the office I was even considering of making some kind of custom application with markup, so people could submit their tests to me instead of word or rtf documents. I tried to teach everyone to use styles in word, but people just seem to not understand the concept, and they ruin all the layout, and make it very tedious to correct everything... I agree with Martin, that it's good that editors are aware of the structure they are creating instead of relying on the visual thing. edit 1: Maruchan, nice! I will bookmark that one edit 2: For markdown there is this live preview http://softwaremaniacs.org/playground/showdown-highlight Link to comment Share on other sites More sharing options...
Marty Walker Posted December 10, 2011 Share Posted December 10, 2011 The way Ryan has wrangled TinyMCE makes it easier to insert (and resize) images, link to other pages with your site. This is quite unintuitive with both Markdown and textile. martkItUp!(http://markitup.jaysalvat.com/home/) might be nice to have when using textile and Markdown (especially when it comes to using custom styles), Ryan's implementation here wins me over. Link to comment Share on other sites More sharing options...
ryan Posted December 12, 2011 Author Share Posted December 12, 2011 I like MarkItUp. Actually I used that in PW1 as an option in addition to TinyMCE. Would be good to bring back at some point. Link to comment Share on other sites More sharing options...
diogo Posted December 19, 2011 Share Posted December 19, 2011 I'm, using the textile module on a site I'm building and there seems to be a bug when building tables. When I do this: | something here | something here | | something here | something here | | a line break here | something here | the line doesn't break. I looked for some reason, And apparently, people that had this problem solved it by adding a raw <br> (bah!), but even this doesn't work with me... here everything works fine http://textile.thresholdstate.com/ Link to comment Share on other sites More sharing options...
ryan Posted December 19, 2011 Author Share Posted December 19, 2011 It's hard to say here. The one at thresholdstate.com is Textile 2.0 and we're using Textile 2.2 (a newer version). I don't know enough about Textile or it's code to be able to debug it very easily, so I think we should try to look at all other factors. Do you have any other text formatters applied to the field where textile is applied? Where did you read about others solving this problem with a <br>? It makes me wonder if this is some known issue with Textile. Also, can you post the full textile code that is failing? I'd like to try and duplicate it here. Link to comment Share on other sites More sharing options...
diogo Posted December 19, 2011 Share Posted December 19, 2011 It's working now, even without raw tags. I redid everything and don't really know what fixed it. I will report if there is something else. Link to comment Share on other sites More sharing options...
diogo Posted December 19, 2011 Share Posted December 19, 2011 Ah... of course... This was the code that was breaking it: $(".menu td:first-child").text(function(n){ var content = $(this).text(); var dots = "..."; var both = content + dots; return both; }); EDIT: Ok, I manage a workaround, although it will mean a bit more complexity to the editor. | _something here_ | something here | | _something here_ | something here | | _a line break here_ | something here | $(".menu td em").append('...'); td em { font-style:normal } Link to comment Share on other sites More sharing options...
MarcC Posted January 11, 2012 Share Posted January 11, 2012 Just saw this: New version of Textile released (v. 2.3) Link to comment Share on other sites More sharing options...
ryan Posted January 12, 2012 Author Share Posted January 12, 2012 Thanks Marc, I will plan to put in this update soon. Link to comment Share on other sites More sharing options...
diogo Posted January 31, 2012 Share Posted January 31, 2012 Ryan, did you consider MarkitUp as an option for imputfield type when using markdown or textile formatters? http://markitup.jaysalvat.com/ Link to comment Share on other sites More sharing options...
ryan Posted January 31, 2012 Author Share Posted January 31, 2012 Diogo, ProcessWire 1.x actually used MarkItUp and it's a great editor. I definitely want to get it going again in 2.x, hopefully soon unless someone beats me to it. Link to comment Share on other sites More sharing options...
keithar Posted February 4, 2012 Share Posted February 4, 2012 Hey, thanks for this useful module. I found small problem on PW 2.2. This code: * _name_ *price* gives me <li><em>name</em> <em>price</em></li> Is this incopability problem with the new PW? Link to comment Share on other sites More sharing options...
ryan Posted February 4, 2012 Author Share Posted February 4, 2012 Keithar, that looks like the output of the Markdown module rather than the Textile module. Can you double check that you are using Textile (only) in that field and not Markdown? I just tried it here with TextformatterTextile and this is the output I got: <ul> <li><em>name</em> <strong>price</strong></li> </ul> Please let me know what you find. Link to comment Share on other sites More sharing options...
ryan Posted February 4, 2012 Author Share Posted February 4, 2012 I've just implemented a few changes/additions to this module: Upgraded to Textile 2.3 Added a separate 'Textile Restricted' version that may be used with untrusted user input (blog comments, etc.) Moved the module to GitHub: https://github.com/ryancramerdesign/TextformatterTextile To upgrade, replace your files in /site/modules/TextformatterTextile/ with the files from the new version. Link to comment Share on other sites More sharing options...
keithar Posted February 4, 2012 Share Posted February 4, 2012 * %test% *cena* After update I get: Textile <li><span>test</span> *cena*</li> Textile Restricted <p>* <span>test</span> <strong>cena</strong></p> So it's a progress Link to comment Share on other sites More sharing options...
ryan Posted February 4, 2012 Author Share Posted February 4, 2012 Interesting, I now get exactly the same thing as you with the Textile 2.3 update (same result in both Textile and Textile Restricted). I take it that everything here is correct except for the *cena* not being translated to <strong>cena</strong>. So I just tried this (taking ProcessWire out of the picture): test.php <?php require("classTextile.php"); $textile = new Textile(); echo $textile->TextileThis('* %test% *cena*'); Result: <ul> <li><span>test</span> *cena*</li> </ul> Bug in Textile 2.3? Link to comment Share on other sites More sharing options...
keithar Posted February 5, 2012 Share Posted February 5, 2012 I've tried http://www.textism.com/tools/textile/index.php . This seems to work ok. I get: <ul> <li><span>test</span> <strong>cena</strong></li> </ul> http://cl.ly/3r2S0R1I271V3W1D0R2N But I can't find what version they are using. Link to comment Share on other sites More sharing options...
ryan Posted February 5, 2012 Author Share Posted February 5, 2012 The version of Textile used at Textism is from sometime between 2003 and 2006. I don't think they've ever upgraded it, but I could be wrong. This FAQ at the Textpattern site says they are using a very old version (see bottom of page): http://textpattern.com/faq/180/common-textile-questions Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now