Allow pluggable output formats.

Fixes #127.