Improved handling of inline formatting tags