烦了很久的 cursor markdown 代码块转义混乱问题 ! 写 prompt 解决了 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
websong188
V2EX    分享创造

烦了很久的 cursor markdown 代码块转义混乱问题 ! 写 prompt 解决了

  •  1
     
  •   websong188 288 天前 2257 次点击
    这是一个创建于 288 天前的主题,其中的信息可能已经有所发展或是发生改变。

    cursor 生成 markdown 会出现代码块转义混乱问题

    使用 cursor 生成带有代码片段的 markdown 文件时,包含代码和 json 的地方,它会自动分割成块

    只能局部应用到 cursor,无法全部应用到 md 文件

    甚至有时候还会出现断开的混乱渲染情况

    提问如果没特别要求,每次输出的情况都可能不一样

    参考 cursor 社区和网上的方法,整合了个常用的 prompt,使用起来挺稳定的

    解决 cursor markdown 格式渲染和代码缩进问题的 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 的结果对比

    3 条回复    2025-02-14 09:40:31 +08:00
    linqiu919
        1
    linqiu919  
       286 天前 via iPhone
    可以,解决一大难题。
    wryyyyyyyyyyyy
        2
    wryyyyyyyyyyyy  
       285 天前
    每次复制好麻烦,为什么不放在 .cursorrules 中呢?
    websong188
        3
    websong188  
    OP
       285 天前
    @wryyyyyyyyyyyy 当然可以!
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     1072 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 22ms UTC 23:19 PVG 07:19 LAX 15:19 JFK 18:19
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86