__I've found a bug and checked that ...__
When perform a search query with search.highlight enabled, code blocks may get interpreted as JavaScript functions, causing the code block to partially render.
This issue is not a theme issue. Most likely it is a Markdown parsing issue. I can't tell what version of Python you are actually using as you've mentioned both 2.7.18 and Python 3.7.
Most likely, I'm guessing you are using Python Markdown 3.3+ which uses a new HTML parser. There are still some bugs being worked out of it as I think it was a bit prematurely released (there just weren't tests in place to catch the kind of edge cases that were discovered after release). You most likely won't have an issue if you use Python Markdown 3.2.2 IIRC.
It could be a theme issue, I already have an idea what's probably causing it - I'll investigate it asap!
Fixed and released as part of Insiders 1.11.2! Text nodes are now properly escaped when using search highlighting:
