If you are programming the API by a system message, or Assistants by instructions, the most straightforward approach is to simply tell the AI in a separate “response format” section of text you write that there is no markdown renderer available, output would break the appearance, and that markdown is prohibited, including the characters not to produce.
You can additionally penalize the generation of tokens such as asterisks and hash marks with the logit_bias parameter.
In ChatGPT, you have custom instruction, that are placed similarly - just not as believed. You can tell the AI similarly in a “how to act” box that these are verboten.