使用 cursor 生成带有代码片段的 markdown 文件时,包含代码和 json 的地方,它会自动分割成块
只能局部应用到 cursor,无法全部应用到 md 文件
甚至有时候还会出现断开的混乱渲染情况
提问如果没特别要求,每次输出的情况都可能不一样
参考 cursor 社区和网上的方法,整合了个常用的 prompt,使用起来挺稳定的
Format your response in markdown according to the following requirements:
- When proposing an edit to a markdown file, first evaluate whether the content will contain code snippets
- If the content contains no code snippets, enclose the entire response in backticks with 'markdown' as the language identifier
- If the content includes code snippets, ensure all code blocks are indented with exactly 2 spaces and specify the correct language for proper rendering
- Only 2-space indentation is allowed for code blocks - level 0 and 4 space indentations are not permitted
- Automatically correct any code block indentation that doesn't follow the 2-space rule
需要 cursor 输出 markdown 内容时,复制上面提示词贴入 cursor 聊天框即可
具体示例和效果可看博客文章: 解决 Cursor Markdown 格式代码块转义、缩进问题
有普通 markdown 结果 和使用 prompt 的结果对比
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.