I would like to recommend that you give direction to cody that when it’s writing a markdown code block to use the “8 preceding spaces” method instead of so it doesn't mess up the chat output. I've been adding that into every prompt where i ask for a markdown code block, to me it should be the default behaviour because the
method screws up the parsing of the output in the chat.
EDIT: i’m leaving the weird formatting in here caused by the ``` because it perfectly illustrates the issue.
1 Like
I just changed my mind on this, the 8 spaces workaround gets annoying. When using those embedded code examples - you have to undo the indentation after and while that’s easy to deal with in a real IDE - it’s obnoxious everywhere else.
I just noticed that Github Copilot has an editable system prompt and as part of the default one it has this instruction:
For Markdown files, you must use four opening and closing backticks (````) to ensure that code blocks inside are escaped.
Example of a code block for a Markdown file:
```code block inside file```
I had completely forgotten that markdown allows for extra fence characters around blocks to allow for nesting blocks. I’m going to include that in my system prompt and see how it goes.
Code Block Example
````markdown
```python
matyroshka
```
````
Blockquote example
This is a blockquote.
Nested Blockquote
“Yo, dawg I heard you like blockquotes”
@closetgeekshow The system prompt could indeed help here to steer the model into the correct style. Hopefully this does help. In my own projects using the Gemini Model, it does enclose all code in triple backticks, which is unfortunate if it should replace text in a file. I had to specifically prompt it not to do that and it works.