Fixed a bug on bold, italic and strike tags

Adding the same character in after a opening tag is invalid but not before it closes (e.g. ~~~invalid~~ and ~~valid~~~)