A Textile Reference | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Sections: Writing in Textile | Quick Block Modifiers | Quick Phrase Modifiers | Attributes | Lists | External References | Tables | ||||||||||||||
Textile is a simple text markup. Simple symbols mark words’ emphasis. Blocks of text can be easily tagged as headers, quotes, or lists. A Textile document can then be converted to HTML for viewing on the web. | ||||||||||||||
You can try Textile out on the Textile home page. Textile is also available as RedCloth for Ruby or PyTextile for Python. | ||||||||||||||
Also refer to the Quick Reference for this guide. | ||||||||||||||
Reading the Examples | ||||||||||||||
In each section below, examples are provided to clearly illustrate. In each example, the Textile example is followed by the raw HTML it is translated into, followed by how the HTML appears in the browser. | ||||||||||||||
Textile example | → | Converted to HTML | ||||||||||||
Browser-view | ||||||||||||||
1. Writing in Textile | ||||||||||||||
Textile looks for paragraphs in your text. Paragraphs are separated by one blank line. Every paragraph is translated as an HTML paragraph. | ||||||||||||||
A single paragraph. | → | <p>A single paragraph.</p> | ||||||||||||
A single paragraph. Followed by another. | ||||||||||||||
Using HTML in Textile | ||||||||||||||
You can certainly use HTML tags inside your Textile documents. HTML will only be escaped if it’s found in a | ||||||||||||||
I am <b>very</b> serious. | → | <p>I am <b>very</b> serious.</p> | ||||||||||||
I am very serious. I am <b>very</b> serious. | ||||||||||||||
Line Breaks | ||||||||||||||
Line breaks are converted to HTML breaks. | ||||||||||||||
I spoke. | → | <p>I spoke. | ||||||||||||
I spoke. And none replied. | ||||||||||||||
Line breaks can be disabled in RedCloth by turning on | ||||||||||||||
Entities | ||||||||||||||
Single- and double-quotes around words or phrases are converted to curly quotations, much easier on the eye. | ||||||||||||||
"Observe!" | → | <p>“ Observe!”</p> | ||||||||||||
“Observe!” | ||||||||||||||
Double hyphens are replaced with an em-dash. | ||||||||||||||
Observe -- very nice! | → | <p>Observe— very nice!</p> | ||||||||||||
Observe—very nice! | ||||||||||||||
Single hyphens are replaced with en-dashes. | ||||||||||||||
Observe - tiny and brief. | → | <p>Observe – tiny and brief.</p> | ||||||||||||
Observe – tiny and brief. | ||||||||||||||
Triplets of periods become an ellipsis. | ||||||||||||||
Observe... | → | <p>Observe…</p> | ||||||||||||
Observe… | ||||||||||||||
The letter ‘x’ becomes a dimension sign when used alone. | ||||||||||||||
Observe: 2 x 2. | → | <p>Observe: 2× 2.</p> | ||||||||||||
Observe: 2×2. | ||||||||||||||
Conversion of trademark and copyright symbols. | ||||||||||||||
one(TM), two(R), three(C). | → | <p>one™, two®, three©.</p> | ||||||||||||
one™, two®, three©. | ||||||||||||||
2. Quick Block Modifiers | ||||||||||||||
Blocks of text default to being treated as paragraphs. But modifers can be affixed to the beginning of a block to change its treatment. | ||||||||||||||
Headers | ||||||||||||||
To make an entire paragraph into a Header, place “hn.” at its beginning, where n is a number from 1-6. | ||||||||||||||
h1. Header 1 | → | <h1>Header 1</h1> | ||||||||||||
Header 1 | ||||||||||||||
h2. Header 2 | → | <h2>Header 2</h2> | ||||||||||||
Header 2 | ||||||||||||||
h3. Header 3 | → | <h3>Header 3</h3> | ||||||||||||
Header 3 | ||||||||||||||
Block Quotes | ||||||||||||||
To make an entire paragraph into a block quotation, place “bq.” before it. | ||||||||||||||
An old text | → | <p>An old text</p> | ||||||||||||
An old text
Any old text | ||||||||||||||
Footnotes | ||||||||||||||
Numeric references within text to footnotes appear between square brackets. | ||||||||||||||
This is covered elsewhere[1]. | → | <p>This is covered elsewhere<sup><a href="#fn1">1</a></sup>.</p> | ||||||||||||
This is covered elsewhere1. | ||||||||||||||
To create the footnote that corresponds to its reference within the text, begin a new paragraph with fn and the footnote’s number, followed by a dot and a space. | ||||||||||||||
fn1. Down here, in fact. | → | <p id="fn1"><sup>1</sup> Down here, in fact.</p> | ||||||||||||
1 Down here, in fact. | ||||||||||||||
3. Quick Phrase Modifiers | ||||||||||||||
Structural Emphasis | ||||||||||||||
Emphasis to text is added by surrounding a phrase with underscores. In HTML, this often appears as italics. | ||||||||||||||
I _believe_ every word. | → | <p>I <em>believe</em> every word.</p> | ||||||||||||
I believe every word. | ||||||||||||||
Strength can be give to text by surrounding with asterisks. In HTML, this strength appears as bold. | ||||||||||||||
And then? She *fell*! | → | <p>And then? She <strong>fell</strong>!</p> | ||||||||||||
And then? She fell! | ||||||||||||||
Both italics and bold can be forced by doubling the underscores or asterisks. | ||||||||||||||
I __know__. | → | <p>I <i>know</i>. | ||||||||||||
I know. I really know. | ||||||||||||||
Use double question marks to indicate citation. The title of a book, for instance. | ||||||||||||||
??Cat's Cradle?? by Vonnegut | → | <p><cite>Cat’ s Cradle</cite> by Vonnegut</p> | ||||||||||||
Cat’s Cradle by Vonnegut | ||||||||||||||
Code phrases can be surrounded by at-symbols. | ||||||||||||||
Convert with @r.to_html@ | → | <p>Convert with <code>r.to_html</code></p> | ||||||||||||
Convert with | ||||||||||||||
To indicate a passage which has been deleted, surround the passage with hypens. | ||||||||||||||
I'm -sure- not sure. | → | <p>I’ m <del>sure</del> not sure.</p> | ||||||||||||
I’m | ||||||||||||||
Pluses around a passage indicate its insertion. | ||||||||||||||
You are a +pleasant+ child. | → | <p>You are a <ins>pleasant</ins> child.</p> | ||||||||||||
You are a pleasant child. | ||||||||||||||
To superscript a phrase, surround with carets. | ||||||||||||||
a ^2^ + b ^2^ = c ^2^ | → | <p>a <sup>2</sup> + b <sup>2</sup> = c <sup>2</sup></p> | ||||||||||||
a 2 + b 2 = c 2 | ||||||||||||||
To subscript, surround with tildes. | ||||||||||||||
log ~2~ x | → | <p>log <sub>2</sub> x</p> | ||||||||||||
log 2 x | ||||||||||||||
HTML-Specific | ||||||||||||||
Lastly, if you find yourself needing to customize the style of a passage, use percent symbols to translate the passage as an HTML span. | ||||||||||||||
I'm %unaware% of most soft drinks. | → | <p>I’ m <span>unaware</span> of most soft drinks.</p> | ||||||||||||
I’m unaware of most soft drinks. | ||||||||||||||
This way, you can apply style settings, as described in the next section to arbitrary phrases. | ||||||||||||||
I'm %{color:red}unaware% | → | <p>I’ m <span style="color:red;">unaware</span> | ||||||||||||
I’m unaware of most soft drinks. | ||||||||||||||
4. Attributes | ||||||||||||||
Tailoring Textile to suit your needs is quite easy. Attributes allow you to provide CSS information about any phrase. | ||||||||||||||
Block Attributes | ||||||||||||||
A block can be tagged with a CSS class by circling the class in parentheses and placing it just before the period which marks the block. | ||||||||||||||
p(example1). An example | → | <p class="example1">An example</p> | ||||||||||||
An example | ||||||||||||||
An element ID can be given by prefixing the ID with a pound symbol and using it in place of the class. | ||||||||||||||
p(#big-red). Red here | → | <p id="big-red">Red here</p> | ||||||||||||
Red here | ||||||||||||||
Class and ID can be combined by placing the class first. | ||||||||||||||
p(example1#big-red2). Red here | → | <p class="example1" id="big-red2">Red here</p> | ||||||||||||
Red here | ||||||||||||||
Style settings can be provided directly by surrounding them in curly braces. | ||||||||||||||
p{color:blue;margin:30px}. Spacey blue | → | <p style="color:blue; margin:30px;">Spacey blue</p> | ||||||||||||
Spacey blue | ||||||||||||||
Language designations can be given between angel brackets. | ||||||||||||||
p[fr]. rouge | → | <p lang="fr">rouge</p> | ||||||||||||
rouge | ||||||||||||||
Phrase Attributes | ||||||||||||||
All block attributes can be applied to phrases as well by placing them just inside the opening modifier. | ||||||||||||||
I seriously *{color:red}blushed* | → | <p>I seriously <strong style="color:red;">blushed</strong> | ||||||||||||
I seriously blushed when I sprouted that corn stalk from my cabeza. | ||||||||||||||
Block Alignments | ||||||||||||||
Text inside blocks can be aligned in four basic ways. | ||||||||||||||
p<. align left | → | <p style="text-align:left;">align left</p> | ||||||||||||
align left | ||||||||||||||
p>. align right | → | <p style="text-align:right;">align right</p> | ||||||||||||
align right | ||||||||||||||
p=. centered | → | <p style="text-align:center;">centered</p> | ||||||||||||
centered | ||||||||||||||
p<>. justified | → | <p style="text-align:justify;">justified</p> | ||||||||||||
justified | ||||||||||||||
Indentation can also be specified by provide a single left paren for every 1em to the left. A single right paren for every 1em to the right. | ||||||||||||||
p(. left ident 1em | → | <p style="padding-left:1em;">left ident 1em</p> | ||||||||||||
left ident 1em | ||||||||||||||
p((. left ident 2em | → | <p style="padding-left:2em;">left ident 2em</p> | ||||||||||||
left ident 2em | ||||||||||||||
p))). right ident 3em | → | <p style="padding-right:3em;">right ident 3em</p> | ||||||||||||
right ident 3em | ||||||||||||||
Combining Alignments | ||||||||||||||
Identation may be coupled with alignment. | ||||||||||||||
h2()>. Bingo. | → | <h2 style="padding-left:1em; padding-right:1em; text-align:right;">Bingo.</h2> | ||||||||||||
Bingo. | ||||||||||||||
And, furthermore, coupled with language settings and CSS styles. | ||||||||||||||
h3()>[no]{color:red}. Bingo | → | <h3 style="color:red; padding-left:1em; padding-right:1em; text-align:right;" lang="no">Bingo</h3> | ||||||||||||
Bingo | ||||||||||||||
HTML in Textile | ||||||||||||||
Textile is designed for quickening the simple markups. For more complex formatting, you are encouraged to break out into HTML. | ||||||||||||||
For example, long code blocks belong between | ||||||||||||||
<pre> | → | <pre> | ||||||||||||
| ||||||||||||||
You may also choose to surround sections with | ||||||||||||||
<div style="float:right;"> | → | <div style="float:right;"> | ||||||||||||
The main text of the page goes here and will stay to the left of the sidebar. | ||||||||||||||
5. Lists | ||||||||||||||
Numeric Lists | ||||||||||||||
To make a numbered list, place each item in its own paragraph, preceded by ”#”. | ||||||||||||||
# A first item | → | <ol> | ||||||||||||
| ||||||||||||||
These lists may be nested by increasing the number of pound symbols preceding child entries. | ||||||||||||||
# Fuel could be: | → | <ol> | ||||||||||||
| ||||||||||||||
Bulleted Lists | ||||||||||||||
Bulleted lists use an asterisk in place of the pound. | ||||||||||||||
* A first item | → | <ul> | ||||||||||||
| ||||||||||||||
These lists may be nested in like manner. | ||||||||||||||
* Fuel could be: | → | <ul> | ||||||||||||
| ||||||||||||||
6. External References | ||||||||||||||
Hypertext Links | ||||||||||||||
Basic links are comprised of a phrase which is linked to a URL. Place the descriptive phrase in quotation marks. Follow it immediately by a colon and the URL. | ||||||||||||||
I searched "Google":http://google.com. | → | <p>I searched <a href="http://google.com">Google</a>.</p> | ||||||||||||
I searched Google. | ||||||||||||||
Notice, the link won’t include any trailing punctuation. | ||||||||||||||
Link Aliases | ||||||||||||||
If you are using the same link several times in your document, or you’d just like to be a tad more organized, you can use a link alias. Place the URL anywhere in your document, beginning with its alias in square brackets. Then, use the alias in place of the URL, using the link format above. | ||||||||||||||
I am crazy about "Hobix":hobix | → | <p>I am crazy about <a href="https://hobix.com">Hobix</a> | ||||||||||||
Embedded Images | ||||||||||||||
You can embed an image in your Textile document by surrounding its URL with exclamation marks. | ||||||||||||||
!https://hobix.com/sample.jpg! | → | <p><img src="https://hobix.com/sample.jpg" alt="" /></p> | ||||||||||||
URLs may be relative. | ||||||||||||||
A title for the image can also be provided in parens, just before the closing exclamation. | ||||||||||||||
!openwindow1.gif(Bunny.)! | → | <p><img src="openwindow1.gif" title="Bunny." alt="Bunny." /></p> | ||||||||||||
The title also acts as alt text should the image not be found. | ||||||||||||||
Links can be attached to images with a colon. | ||||||||||||||
!openwindow1.gif!:https://hobix.com/ | → | <p><a href="https://hobix.com/"><img src="openwindow1.gif" alt="" /></a></p> | ||||||||||||
Image Alignments | ||||||||||||||
Alignments can be applied as well to images. | ||||||||||||||
!>obake.gif! | → | <p style="float:right"><img src="obake.gif" alt="" /></p> | ||||||||||||
And others sat all round the small machine and paid it to sing to them. | ||||||||||||||
Acronyms | ||||||||||||||
Definitions for acronyms can be provided by following an acronym with its definition in parens. | ||||||||||||||
We use CSS(Cascading Style Sheets). | → | <p>We use <acronym title="Cascading Style Sheets">CSS</acronym>.</p> | ||||||||||||
We use CSS. | ||||||||||||||
7. Tables | ||||||||||||||
Simple tables can be built by separating fields with pipe characters | ||||||||||||||
| name | age | sex | | → | <table> | ||||||||||||
| ||||||||||||||
Specify header cells by marking them with an underscore and period. | ||||||||||||||
|_. name |_. age |_. sex | | → | <table> | ||||||||||||
| ||||||||||||||
Cell Attributes | ||||||||||||||
The period used above marks the end of a cell’s attributes. Other attributes can be applied as well. | ||||||||||||||
|_. attribute list | | → | <table> | ||||||||||||
| ||||||||||||||
You can also specify colspans with a backslash, followed by the cell width. | ||||||||||||||
|\2. spans two cols | | → | <table> | ||||||||||||
| ||||||||||||||
Rowspan is specified by a forward slash, followed by the row height. | ||||||||||||||
|/3. spans 3 rows | a | | → | <table> | ||||||||||||
| ||||||||||||||
All block attributes can be applied to table cells as well. | ||||||||||||||
|{background:#ddd}. Grey cell| | → | <table> | ||||||||||||
| ||||||||||||||
Table and Row Attributes | ||||||||||||||
Table-wide attributes can be applied before the first row of the table. On its own line, followed by a period. | ||||||||||||||
table{border:1px solid black}. | → | <table style="border:1px solid black;"> | ||||||||||||
| ||||||||||||||
Attributes can be applied to a single row by supplying the attribute before the row starts, using a | ||||||||||||||
|This|is|a|row| | → | <table> | ||||||||||||
| ||||||||||||||