Allow context to be passed in to formatters, from, e.g. serrano.

This change should be coordinated with a change on the serrano side (a parallel pull request).