Support custom formatters

Add support for building custom formatters in client code by making the internal tree structure visible. This would enable creating new formatters for types other than strings and very specific to the client code.