2007-12-20

WikiText Primer

Wikitext is the wiki and bbcode-like markup language I use to author this website. It is a relatively simple line-based system:

A normal line is a paragraph, just like this one.

Monospace code quoting is supported by prefixing the line with %:

% for(int i = 0; i < 7; i++) { % printf("%d\n", i); % }

Gives:

for(int i = 0; i < 7; i++) { printf("%d\n", i); }

Quoting someone elses text uses a similar method to email:

> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. > Ut cursus laoreet velit. Ut malesuada. Donec orci. Sed nec > justo pulvinar ligula tempus mollis.

Gives:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut cursus laoreet velit. Ut malesuada. Donec orci. Sed nec justo pulvinar ligula tempus mollis.

Ordered and unordered lists (numbers and bullets) are supported, one per line by prefixing with # and * respectively:

* foo * bar * baz # one # two

Gives:

  1. one
  2. two

They may be nested:

# one #* foo #* bar # two #* foo #*# one again # three

Gives:

  1. one
  2. two
  3. three

There is a generic inline directive system, which parses text contained in square brackets. This is modular and is leveraged by many kinds of directive handlers, the most important are links and internal article references.

* [link http://www.google.com/ I'm a link to google]. * [article 138 Some Article]

Gives:

There are many other line-based things, like headers prefixed with equals, and inline styling primitives for emphasis and strong.

Leave a comment on this article.