Textile

### Movable Type User Manual: Textile

« Table of Contents

- Textile

- Block Formatting
- Inline Formatting
- Character Formatting
- Table Formatting
- Multiple Filters
- Credits

# Textile

The Textile text formatting option takes a lot of the pain out of HTML composition.

Textile works by looking at your text in terms of lines and paragraphs. Paragraphs are composed of one or more lines, separated by a single new-line character. Paragraphs are separated by one or more blank lines.

## Block Formatting

For each new paragraph, you may begin the paragraph with one of the following markers:

- hn. A lowercase 'h', followed by the number 1-6, followed with a period (.) and a space begins a heading tag. The tag will be numbered after the number you specify. The entire block will be enclosed in the header tag.
- bq. A lowercase 'bq.' and a space will define a blockquote block.
- bc. A lowercase 'bc.' and a space will define a blockcode block (note that this will produce a `<pre><code>...</code></pre>` block since `<blockcode>` is just an announced tag for the future XHTML 2 specification).
- p. A lowercase 'p.' and a space will define a paragraph tag. This is the default if no other marker is specified.
- # A block beginning with '#' and a space will start a numbered list. Each additional new line beginning with one or more '#' characters and a space will become a new numbered item.
- * A block beginning with '*' will start a bulleted list. Each additional new line beginning with one or more '*' characters and a space will become a new bulleted item.
- == A block beginning with '==' will cause Textile to turn off its formatting rules until it reaches the ending '==' (which may be at the end of the current paragraph or some later paragraph).
- Wiki Tables You can use Wiki-style syntax to build simple tables.
- table. Optional prefix for Wiki-style tables that allow for CSS class and id assignment.

All these markers must be at the beginning of the new paragraph, without any leading spaces. If line breaks exist within the block, they will be translated into `<br />` tags automatically. And optionally, you may add a CSS class name in parenthesis preceding the period of the heading, blockquote or paragraph markers. If a CSS class name is given in this way, it will be assigned to the block tag.

With the exception of the '==' marker, each of these can include a CSS class and/or id assignment in one of these forms:

- (class#id) Class and id assignment.
- (class) Class assignment.
- (#id) Id assignment.

For example:

    p(first). First paragraph.

The '#' and '*' markers can have a CSS class/id prefix as well as a suffix. If a prefix is used like this: `(class#id)#`, then the class and/or id are assigned to the `<ol>` tag. If the class/id appears after the '#' or '*' characters, then it is assigned to the `<li>` tag. You can combine them as well (the prefix is only valid for the first item on a given level. Multi-level lists are supported, like this:

    * Item one
    * Item two
    ** Sub item 1
    ** Sub item 2
    ### Point 1
    ### Point 2
    * Item two

You may also use regular block formatting HTML tags if you prefer.

## Inline Formatting

Within each block, the following inline formatting shortcuts are provided:

- _emphasis_: Text surrounded underscores will be formatted using the <em> tag.
- *strong* Text surrounded by asterisks will be formatted using the <strong> tag.
- ??citation?? Text surrounded by a pair of question marks, it will be formatted using the <cite> tag.
- -deleted text- Text surrouned by a single dash will be formatted using the <del> tag.
- +inserted text+ Text surrounded by plus signs will be formatted using the <ins> tag.
- ^superscript^ Text surrounded by caret characters will be formatted using the <sup> tag.
- ~subscript~ Text surrounded by tilde characters will be formatted using the <sub> tag.
- @`code`@ Text surrounded by '@' characters will be formatted using the <code> tag.
- "linktext":url Text within quotes followed with a colon and a URL (fully qualified or relative) will be formatted into a hyperlink. Relative URLs must start with "./" or "../" to be distinguished from "domain/file.html". Link variants include:
  - 'title' text: `"Link (Title)":url`
  - CSS class: `"(class)Link":url`
  - CSS id: `"(#id)Link":url`
  - CSS class/id: `"(class#id)Link":url`
  - Mail link: `"E-mail me":me@mydomain.com`
  - FTP link: `"FTP Site":ftp://ftp.domain.com/directory`
- !image_url! A URL (fully qualified or relative) within exclamation characters will be formatted into an <img> tag. You can also add "alt" text for the <img> tag like this: `!image_url(alt text)!`. Finally, a CSS class and/or id can be specified following the opening '!' character. Other options available:
  - 'alt' text: `!image_url (This is my image)!`
  - CSS class: `!(imgright)image_url!`
  - CSS id: `!(#figure3)image_url!`
  - CSS class/id: `!(imgright#figure3)image_url!`
  - Width, height (positional): `!image_url widthxheight!`
  - Width, height: `!image_url widthw heighth!`
  - Width, height (percentage): `!image_url 50%!`
    Percentages only work with local files, where the actual width and height can be determined. The "Image::Size" Perl package must be present for this. This sets both the width and height to 50% of it's normal value.
  - Width, height (percentage): `!image_url 20%x30%!`
    This sets the width to be 20% of it's original value, and the height to be 30% of it's original value.
- ABC(Acronyms Be Cool) Uppercase alpha-numeric characters followed by text in parenthesis will be formatted into an <acronym> tag (using the parenthetic text for the 'title' attribute).

A series of two or more uppercase alpha-numeric characters will be wrapped with a <span> tag and assigned the 'caps' class.

You can also use regular HTML tags when composing your entries. Also, special characters within your entry text such as <, >, &, international and symbol characters will automatically be escaped into equivalent HTML entities.

If you use a `<pre>` tag, it isn't necessary to escape special characters within it-- they will be automatically escaped, until the closing `</pre>` tag is reached.

## Character Formatting

- (tm) translates to ™
- (c) translates to ©
- (r) translates to ®
- nxn When letter 'x' is surrounded with digits, it is translated to the × character.

Additionally, the raw symbols for ™, © and ® will be escaped to HTML entities. Most international characters and symbols will also be escaped to HTML entities.

Unescaped & characters within tag attributes will be escaped automatically.

If you have the Smarty Pants Movable Type plugin installed, it will automatically be used to 'educate' your quotes, ellipsis and dashes to their typographic counterparts.

## Table Formatting

Tables can be easily composed with MT-Textile markup. Here's a simple table as an example:

    |_ Name|_ Age|
    |Savannah|4|
    |Seth|1|

Whitespace on the left and right within cells are ignored, so you can use extra spaces to visually line up your table to your liking. The '_' character next to the '|' character identifies that cell as a header cell.

CSS class/ids can also be assigned to table, row and cell elements. To assign a table class and/or id, you must use the "table." block prefix like this:

    table(scores). |_ Team   |_>  Score |
           (winner)| Red Sox |(rec) 240 |
                   | Mets    |        4 |

The class marker "winner" on the second line assigns the "winner" class to the <tr> tag for that row. The class marker "rec" assigns the "rec" class to the <td> tag for that cell. This example also demonstrates the right-alignment flag '>'. All cell attributes must be placed just to the right of the opening '|' character for that cell. Here are the available cell attribute flags:

- _ (underscore): header cell
- ^: center
- <: left-justified
- >: right-justified
- (class#id): CSS class and id
- (class): CSS class only
- (#id): id only

## Multiple Filters

MT-Textile also allows for multiple filters to be used using the '==' sections. Here's an example:

    ==|fudd|Where is that rascally rabbit?==

If you have the MovableJive plugin installed, this will use it to format that sentence using it's "fudd" filter. The output would look like this:

    <p>Whewe is dat wascawwy wabbit?</p>

## Credits

The Textile text formatting code for Movable Type was written by Brad Choate. The Textile formatting syntax was developed by Dean Allen. Many thanks to Dean for his permission to adapt Textile for use in Movable Type.