Textpattern CMS includes support for Textile, a markup language for formatting content. For website with a bunch of text, this can make inline formatting of text more time-efficient with fewer keystrokes. For this how-to, I’m going to explain phrase modifiers in Textile. The easiest way to play along is to spawn a new Textpattern instance on your Arvixe hosting account with Softaculous.
When I say phrase modifiers, I mean:
- Strong and bold text
- Emphasised and italic text
- Superscript and subscript text
- Insertions and deletions
- Inline code
Compared to some of the other stuff I’ve covered in Textile, these are all pretty straightforward to achieve. The easiest way to show you how to translate from HTML is by example, so here’s one to start off with:
<p>This is normal text.<br /> <strong>This is strong text.</strong><br /> <b>This is bold text.</b></p>
With Textile, it’s a matter of enclosing the text in asterisks:
This is normal text. *This is strong text.* **This is bold text.**
Italics and emphasised text works in a similar fashion:
<p>This is normal text.<br /> <em>This is emphasised text</em><br /> <i>This is italicised text</i></p>
Instead of asterisks, use underscores:
This is normal text. _This is emphasised text_ __This is italicised text__
Note that the DOCTYPE you use may have deprecated or outlawed use of some tags. For example, HTML5 deals with `<b>` and `<i>` tags differently to HTML4, and the variety of old/new browsers mean that not all visitors will see your page the same way.
Superscript and subscript, or high and low text. In HTML, it’s typically done like this:
<p>This sentence ends with superscript <sup>hello</sup><br /> This sentence ends with subscript <sub>hello</sub></p>
Textile makes is a little quicker with carets and tildes:
This sentence ends with superscript ^hello^ This sentence ends with subscript ~hello~
When text is deleted and/or inserted, it’s usually marked up in HTML like this:
<p>My favourite fruit is a <del>guava</del> <ins>pomegranate</ins> and I eat one every day.</p>
The Textile version of this is with a minus and plus around the deleted and inserted text. It’s delightfully simple:
My favourite fruit is a -guava- +pomegranate+ and I eat one every day.
With citations, text is wrapped in double question marks. Take the following HTML:
<p><cite>I am sure my recurring theme of fruit in Arvixe articles is the right move.</cite><br /> <cite>I can always fall back on smoked cheese if my fruit interest dries up.</cite><br /> — Pete Cooper</p>
Liberal use of question marks makes this a cinch in Textile:
??I am sure my recurring theme of fruit in Arvixe articles is the right move.?? ??I can always fall back on smoked cheese if my fruit interest dries up.?? -- Pete Cooper
It’s true, I do love smoked cheese.
Finally, and without further ado, it’s code time. Take the following example from earlier in this article:
<p>HTML5 deals with <code><b></code> and <code><i></code> tags differently to HTML4.</p>
I’ve styled it differently to make a point, but inline code is easily achieved in Textile with some at symbols:
HTML5 deals with @<b>@ and @<i>@ tags differently than HTML4.
Note that the HTML output escapes the greater-than and less-than brackets. If that didn’t happen, websites would break – not good.