Looks like the cursor has a problem when editing markdown content

Looks like the cursor has a problem when editing markdown content. If the content contains ```json, it will be excluded from the text to be saved. This issue occurs with both chat and the composer.

6 Likes

This has been an issue for me for weeks.

2 Likes

@msc Looks like this issue is fixed in version 0.40.2; everything works well now.

1 Like

Thank you Liz! I’m looking forward to trying the upgrade.

I am using the 0.40.3 and still I see the issue. When it needs to include the ``` to start or end a coding section in the markdown file, it jumps back into the chat and leave the file edit incomplete. I am not sure how you parse the output of the LLM to display it in the chat UI or the file edit UI, but it seems that the use of ``` interferes with this process.

4 Likes

I have the exact same problem. If i ask composer to create new .md file with an python example or json example or whatever that includes ‘’’ …then it won’t work. Same goes for editing.

Version: 0.40.3
VSCode Version: 1.91.1
Commit: 2804893a83ef162ae6c48e8254717e25c7c7c510
Date: 2024-08-29T17:42:50.254Z
Electron: 29.4.0
ElectronBuildId: undefined
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Linux x64 5.15.0-119-generic

1 Like

@msc @hadinayebi @jim
I rechecked with version 0.40.3, and the issue still exists. You should use cmd+k to edit markdown files.
If you use chat to brainstorm, you can press cmd+k and then @chat to reference content from the chat.

2 Likes

I am having the same issue. I use chat a lot as I write technical tutorials and almost all of my messages include code blocks.

1 Like

I have found that cmd K does not work on Markdowns as it a markdown command and conflicts with the AI window.

1 Like

I had success asking the chat to escape the markdown before outputting

2 Likes

Still get this problem on last version.
Drive me crazy and use all my requests… for nothing…

3 Likes

I guess a hack is to add this to the persistent prompt:
plz use ~~~ instead opf ``` for code blocks when you suggest edit for markdown files

1 Like

same here- when I ask it to create .md files it will often only create half of it before this error happens.

1 Like

When this happens, I can usually get Cursor to format the response in uninterrupted markdown by resubmitting my last message with the following formatting instructions added to the end:

  • Provide your response as a markdown file
  • Wrap the beginning and end of your answer in backticks and markdown as the language.
  • If there are code snippets, display the code as plaintext in markdown and do not add any additional formatting such as backticks or indents
  • DO NOT ADD ANY FORMATTING INCLUDING BACKTICKS WITH THE EXCEPTION OF INDENTS INSIDE THE MARKDOWN

I also have these instructions in the Rules for AI section of my Cursor Settings formatted like below so in theory I can just ask it to give me its reply in “devdoc format” to get this formatting instead of having to paste in all the rules, but this doesn’t work 100% of the time …

Format your response to follow these strict formatting rules, when I request you provide the response in “devdoc format”:

  • Provide your response as a markdown file
  • Wrap the beginning and end of your answer in backticks and markdown as the language.
  • If there are code snippets, display the code as plaintext in markdown and do not add any additional formatting such as backticks or indents
  • DO NOT ADD ANY FORMATTING INCLUDING BACKTICKS WITH THE EXCEPTION OF INDENTS INSIDE THE MARKDOWN

Hope this helps!

2 Likes

Yes, this is a big inconvenience for me as well! The suggested solution from @devgrinder works fairly well.

Update on this …

I have found the most reliable and most convenient way to implement this is by creating a file in your codebase with these instructions. For example, I have a file called md_format.md with this as the contents:

Format your reponse in markdown with these strict formatting rules: 
- Provide your response as a markdown file
- Wrap the beginning and end of your answer in backticks and markdown as the language.
- NEVER EVER UNDER ANY CIRCUMSTANCES ADD ANY BACKTICKS INSIDE THE MARKDOWN.
- If there are code snippets, you will be tempted to add backticks around the code but DO NOT DO THIS. Instead you can indent the code with 4 spaces. This applies to any output you might normally wrap in backticks, including but not limited to:
0. JSON
1. Programming code in any language
2. Command line instructions
3. Configuration files
4. Raw data formats like JSON
5. File paths or system output
6. Stack traces or error messages
7. Markup languages (HTML, XML, etc.)
- Check your output before providing it to me and ensure it complies with ALL these rules WITHOUT EXCEPTION.

Now, any time I want the model to return their response in this codeview/markdown format, I just add @md_format.md to the end of the message. It works about 95% of the time.

3 Likes

I had the same problem today

1 Like