Plain Text > Textile Parser > HTML
I write a lot of HTML by hand. Have done for years. But when I started this blog, I knew I’d stay a lot saner using a tool such as Markdown, Textile or reStructuredText to generate the final markup for me. I know most people use Markdown but as a contrarian, I chose Textile. I’ve found that Textile gets the balance between ease-of-use and power just right.
Let’s dive right in and have a look at how you write textile documents.
The Basics
Headings
Headings are simply h1. to h4. followed by your heading (all on the same line):
h1. This is my heading
will produce
This is my heading
h4. This is my tiny heading
This is my tiny heading
Paragraphs
Paragraphs are blocks of plain text separated by two newlines. You just type as you would in a text editor. The Textile parser will wrap your paragraphs in <p>
tags.
Text formatting
Underscores are used to _emphasise_
text. Bold text needs an *asterisk*
on either side of what you want to be bold. If you want emphasised, bold text, just use both _*together*_
:
really important you understand this. Easy.
Lists
Unordered (bullet) lists use asterisks as well. If you need sublists, add asterisks for each sub-level:
Here is my shopping list
* Milk
* Bread
* Ingredients for cake:
** Eggs
** Chocolate
** Sugar
Personally, I think that is very easy to remember and use. This will output:
Here is my shopping list
- Milk
- Bread
- Ingredients for cake:
- Eggs
- Chocolate
- Sugar
Ordered (numbered) lists use the hash character #
for each list item:
How to make a cuppa
# Get a cup
## Place teabag and sugar (if desired) into cup
# Boil a kettle
# When boiled add water to cup
# etc.
Which renders to:
How to make a cuppa
- Get a cup
- Place teabag and sugar (if desired) into cup
- Boil a kettle
- When boiled add water to cup
- etc.
The Textile parser will keep track of numbering for you.
Links
here is a link to my "website":https://simonh.uk
here is a link to my website
Link text in double quotes, immediately followed by a colon, then the URL
Additional Textile Features
This is where Textile beats the competition (in my opinion).
p>. This text is right aligned.
p=. This text is centred.
p<. Back to left aligned (the default).
Which produces:
This text is right aligned.
This text is centred.
Back to left aligned (the default).
Tables
Example below copied from the Textile website.
| A | simple | table | row |
| And | another | table | row |
| With an | | empty | cell |
A | simple | table | row |
And | another | table | row |
With an | empty | cell |
There’s a lot more you can do with tables. Consult the Textile documentation for more info.
Footnotes
This line of text has a footnote[1]
This line of text has a footnote1
At the bottom of your Textile document, you simply write
fn1. This is the footnote text.
Increment the footnote for each one you created in the document
fn2. Here's the second one.
Conclusion
Dean Allen, the guy who created Textile for a CMS he was writing explained why he created the format (from Wikipedia):
Textile was developed by Dean Allen in 2002, which he billed as “a humane web text generator” that enabled you to “simply write”.
I think he did a great job.
Footnotes
1 I told you there was a footnote down here!