check bounds so we don't include markers that are off the end of the
string when generating substrings.
Make preset style work in html text widget.
Remove a large amount of obsolete code.