Mephisto this blog content management system, comes with two markup languages available. The one I use is Textile and I’ve already introduced his main characteristics and the reasons I have chosen it. But I decided to give the other markup language – Markdown – a try. So this post will give show a bit how it works.

Markdown - Readable markup language

Markdown contains a somewhat simple list of rules that cover most of the syntax web content creation needs. It converts plain text into valid XHTML (or HTML). While Textile characteristics enable a non-stop writing flow, Markdown’s syntax results from tokens that seem familiar to us from plain text files. This way, the markup content is very easy-to-read, before the content was even translated and rendered as (X)HTML. And since we’re already used to those characteristics, it isn’t hard to learn this new language. However, it also creates a set of dispensable characters, the price to pay for better readability.

Links

First the most characteristic rule: creating links. There are several possibilities, it’s a matter of personal choice. Some examples:

[Markdown](http://daringfireball.net/projects/markdown) is a [markup language][] created 
by [John Gruber][author]. You can find the license on 
<http://daringfireball.net/projects/markdown/license>.

[markup language]: http://en.wikipedia.org/wiki/Markup_language  (Wikipedia entry)
[author]: http://daringfireball.net  (Daring Fireball)


Will result on:

Markdown is a markup language created by John Gruber. You can find the license on http://daringfireball.net/projects/markdown/license.

As you can see you can inline the URLs in the text using [text](url) or [text](url `title`). You can also include the actual URL using <url>. But the most clean way is by defining only the text first with [text][id] and then, anywhere in the file, [id]: url (title). If you don’t define an id – [text][] – the text will become the id itself as you can see in the markup language case.

This kind of URL reference keeps the text cleaner and more readable while turning the job on maintaining links updated more easily (no need to scan the text looking for them).

Styling

There are only two types of emphasis:

*word* or _word_
for <em> tags and

**word** or __word__
for <strong> tags.

For headers you can use two types of syntax. Underlining equal signs or hyphens, creates <h1> and <h2> tags respectively. Like this:

Big Title
=========

Sub-Title

—————

Alternately, you can use # characters:

# Big Title
## Sub-Title
### Sub-Sub-Title


For lists, you just have to insert the * character before each element:

* I
* has
* List


If you need an ordered list, this is the way:

1. This
2. Is
3. Ordered


You don’t have to really insert each number correctly, only 1. on every element would work as well, but it would ruin the readability part of the markup.

Finally, if you want to find out the whole set of rules check out this page for reference. There you can also find Dingus, a web markdown translator for you to try out the language. You should also check this example of a complete article written in Markdown to show that it is indeed an easy-to-read language.

SmartyPants

Markdown usually comes with the SmartyPants plugin (available on Mephisto), also created by John Gruber. SmartyPants beautifies certain characters output, like quotes to curly braces, dashes to en- and em-dashes and three dots into ellipsis.

Libraries

Markdown libraries are available for most of the mainstream languages. Here’s a small list of some:

If you enjoyed this post, consider subscribing to my RSS Feed RSS feed icon

Leave a Comment

Follow this post comments with this RSS feed.