Welcome back to my latest Textpattern CMS article. Today I want to introduce you to Textile, the text processor baked into Textpattern. At a high level, Textile is a substitution tool that offers a more humane way of formatting text in Textpattern articles. Textile was created by Dean Allen, who also created Textpattern. The two projects were intrinsically linked for a time, but now Textile can be found outside of the Textpattern realm. With that in mind, here are some bullet points to kick off:
- Textile can be used in Textpattern articles and it’s optional – you are not required to know/use it
- Textile is, at present, the only native text processor in Textpattern
- Textile syntax in Textpattern is the same as that outside of Textpattern – you don’t need to learn more than one variant
- Textile has some common features with Markdown, but they have different origins and use different syntax
The Textile demographic, if there is such a thing, might include:
- developers familiar with (X)HTML who want a shorthand method of writing articles
- authors not familiar with (X)HTML who want to style article text
- commenters who want to style their comments on Textile-enabled websites
- lazy/efficient people who want to type less
I mean no disrespect by the ‘lazy’ reference in that last bullet point, because one of the plus-points of Textile for me is the speed at which it lets me write articles. Now, I have been learning (X)HTML, CSS and other high-level markup since 1999; when I joined the Textpattern fray some years ago, I became aware of Textile but didn’t warm to it immediately. I regarded it as just another thing to learn. It wasn’t until the advantages of the syntax were shown to me – one of which was, essentially, ‘type less, let Textpattern do the work and get the same end result’ – that I started to learn it. As of February 2014, I know some Textile and I will continue to learn as my needs dictate; this is chiefly down to finding a way for my brain to use it in a natural way. If it’s forced, then it’s slowing me down, there’s no benefit. If you choose to investigate Textpattern as your content management system, then you can either use Textile or ignore it. There are, to my knowledge, no features or functions that are off-limits to you should you choose the path of using (X)HTML, CSS and Textpattern tag markup.
Textile is plain text. Rather, the Textile syntax is plain text that gets converted into markup when it’s used in Textpattern articles and comments. The Textile tags are left in the article body as Textile tags and Textpattern processes them using the in-built Textile processor. I’m going to talk about Textile vs (X)HTML in some detail next time, but here’s a quick primer on a couple of Textile tags to get you started.
Textile can be used in place of (X)HTML for quick text styling. To make text bold in HTML4 and HTML5 (at the present time, the specification is still at the working draft stage), the <b> and </b> or <strong>and </strong> tags are used, depending on what level of browser support and the meaning you want to convey. With that in mind, to wrap text in <strong> tags, use an asterisk, like this:
…and you’ll see this in the markup:
…and if you want to wrap text in <b> tags, you can use two asterisks:
…and you’ll see this in the markup:
In a similar vein, italic and emphasised text uses <em> and <i> tags. Ignoring the redefined role of <i> in HTML5 for now, you can achieve emphasised text with an underscore and italicised text with two underscores. Like this:
which gives you:
While these are simple examples, they’re a good way to start to learn Textile and perhaps figure out whether it’s a good fit for you. Next time I’ll be showing you some more Textile examples and their (X)HTML equivalents. I do hope you’ll join me.