This is a Markdown bug, so I’m not sure anything can be done about it here… Still, just in case, here’s a topic.
If you have the following string:
backtick, formatted text, space, backtick, space, any character
The space after the closing backtick is trimmed, but a space appears before the closing backtick.
It is to be noted that markdown trims prepending and appending spaces in inline code formatting, which is its regular behavior:
A GIF will show the issue better than circumvoluted explanations: