This may be also caused by confusing syntax highlighting in some editors, for example in VSCode [1]
The variable in the second string gets highlighted (with slightly different color, but still) because it would still work with `str.format()`. GitHub doesn't seem to do this.