To be clear from the beginning: the problem is in the rendering of the code blocks, not on the llm itself. The problem is that if literal code backquates appear in the assistants code output, then the renderer will handle that weird and unicode html entries will start appearing in the code (in particular ' instead of single quotes). If I copy the whole answer and paste it in a normal editor, there is no issue. If I copy the code block using the copy button on top of it, I get the unicode literals etc instead of the right code. I guess having triple backticks appearing in the code is not very common, it happened asking the assistant to create a script to write a script to convert markdown to html.
Here is an example of the problem
https://kagi.com/assistant/24a3ed82-9f10-4658-91c4-9bde657c3bfa
An image example: (note that this is not the first instance of backticks in the output which now I think it can be confusing. But the output started being messed up from before what the image shows)
I expected: The code block to render correctly, the renderer somehow recognise that the presence of triple backticks in the middle of a line among other characters does not signal the end of the codeblock