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.

2 Likes

This has been an issue for me for weeks.

1 Like

@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.

3 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.

1 Like

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

1 Like

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

1 Like

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

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!