12 June 2007

My personal markdown cheat-sheet

Markdown (by famous John Gruber of Daring Fireball) is a nice and clean markup language to facilitate writing for the web. As the original doc spans 19 pages (too much for lazy folks like me), I summarize the most important commands/tags here.


Markdown enthusiasts, please forgive me. This list is not ment to be complete. Errors are mine, all credit to John Gruber!


Headings

Preceed heading with 1-6 hashes (#). Example:

# This is H1

Note: Closing #’s are optional.


Lists

Begin a list item with an asterisk (*), a plus (+) or minus (-).

To enumerate list items, preceed item with a dotted number:

1. first item

2. second item

1. third item (yes - markdown can handle it...)

yields:

  1. first item

  2. second item

  3. third item (yes - markdown can handle it…)

Note: Markdown cares for the correct numbering, your actual numbers are ignored.


Horizontal Lines

To draw a horizontal line, just put *** or === on a line by themselves.


Emphasized text

Enclose a word in * or _ (underscore) to emphasize - both are rendered into `` tags. You might use ** to make things especially important :-)
For example: `important` yields important.


  1. Trivial: Surround link with < and >, like this: <http://www.gernotstarke.de> yields http://www.gernotstarke.de.

  2. Simple way: [an example](http://www.it-and-more.blogspot.com/ "My Blog") for inline links, results in “an example for inline links”.

  3. Reference links (cool!): This is [an example][id] for reference links. Some lines later you define your link-label on a line by itself:

`[id]: http://it-and-more.blogspot.com/ (with a title)

Yields: an example


  1. Even cooler, implicit name shortcuts: I get 10 times more traffic from [Google][] than from [Yahoo][] or [MSN][].

and the links defined as follows:

[google]: http://google.com/ (Google)

[yahoo]: http://search.yahoo.com/ (Yahoo Search)

[msn]: http://search.msn.com/ (MSN Search)

Yields: I get 10 times more traffic from Google than from Yahoo or MSN.

This options is way shorter to write.


Images

Similar to links, start with !(exclamation mark). Example: ![Fireball](/http://farm1.static.flickr.com/166/375786793_420d06879f_s.jpg "small fireball").



Fireball

You might use reference id’s, as in links… very practical.


Code Blocks

Want to write source code on web pages? Geek, aren’t you? Just indent every line of the block four spaces or 1 tab.

Note: Markdown behaves nicely, it converts ugly & and Umlaut-stuff like ÜÖÄ into proper HTML entities.

Single lines of code (or even single words) are wrapped with backtick-characters `.


Tables, Footnotes,



Gotta use HTML for such kind of things.