Use toHTML vs. instanceof checks for SafeString

Allows for us to play nicely in environments such as Node that could have
multiple versions of the library loaded. Also allows for implementors to
provide their own behavior, provided they know what they are doing.

Fixes #886