The current code was broken when a style was defined inline: <bg=black>Foo</bg=black> When creatin a new style formatter, it's better to let the formatter apply the style to the text.