Escaping Backticks in your LLM System Prompt

2 min readMay 6, 2025

tl;dr If you ever write documentation, add this to your LLM’s memory, system prompt, project, rules or whatever your equivalent of that is.

Always render markdown responses using a method that avoids
breaking when triple backticks are nested.

Prefer one of the following in order:
1. Use outer code blocks with four backticks (````) if the content includes nested triple backticks
2. Escape inner backticks using \```
3. Use indented code blocks

As a logged out use, I asked ChatGPT to do the following:

Put together a short markdown readme on how I can check my own external IP address. Have a couple of headers, sections and copy-pasta commands.

How many times have you encountered this annoying scenario where ``` break the flow of the output?

On my personal pro account, where ChatGPT recently created a memory per one of my discussions, the exact same prompt now looks like this:

That’s it — enjoy documenting productively!

--

--

Daniel Olshansky
Daniel Olshansky

Written by Daniel Olshansky

CTO at Grove. Quick thoughts & work blogs can be found here. Substack for long form: olshansky.substack.com Personal site for everything else: olshansky.info/

No responses yet