Solve problems with AI use of backticks by defining custom code-wrapping notation

Problem – Currently, the AI has a lot of trouble formatting its responses if those responses include the use of backticks for reasons other than demarcating code blocks: Backticks that aren’t intended to start/end code blocks do so anyways, scrambling the rest of the AI’s output.

Proposed Solution – Since the AI’s definition of a code block is entirely internal to Cursor, you could instruct the AI to surround code blocks in custom tags that are stripped/hidden in the final output. This would allow backticks to be displayed normally, wherever the AI wishes to use them, without affecting the formatting of the response.

For example, you could instruct the AI to surround code with the following, depending on whether it’s inline or a code block:

E.g. (Inline Code) – <CCode>(… inline code …)</CCode>
E.g. (Code BlocK) – <CCBlock lang="javascript"> (… code block …) </CCBlock>

Then you could use those tags to format the response, and leave any backticks the AI has included unchanged.

1 Like

Makes sense. Cursor needs to handle this better.