API change to bring compile time safety.

Instead of having an adhoc $text event, use separate calls to register tag and text events which allows to provide compile time callback safety.