最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】VSCode中保存Markdown时原内容被改变

markdown crifan 5707浏览 0评论

VSCode中,去保存一个无序列表:

* 客户类型

* 购车意向级别

但是被显示出 Table of Contents(out of date)

Command+S保存时,结果内容却就变成了:

看起来和那个OUTLINE有关系?

好像是最近给VSCode安装了一个markdown有关的插件,而导致的?

vscode table of contents out of date

curioustechizen/vscode-markdown-toc: Visual Studio Code extension to generate a Table of Contents for Markdown documents

vscode unordered list table of contents out of date

Markdown All in One – Visual Studio Marketplace

难道是这个插件导致的?

因为此处只有2个和markdown有关的插件:

禁止掉Markdown All in One 看看是否解决问题。

退出重新打开VSCode,结果:

果然是:

没有了TOC,也没有了OUTLINE:

【总结】

在(Mac中的)VSCode中安装了Markdown All in One后,在md文件中,此处写无序列表时,就会被识别为和TOC,且显示

Table of contents(out of date)

然后一旦保存,就自动换成了 此处的TOC,导致内容丢失。

解决办法:

卸载掉Markdown All in One即可。

【后记】

后来为了:

在输入*后回车可以自动输入无序列表的*,还是开启了:Markdown All in One

但是又遇到了:

所以去看看配置:

markdown.extension.toc.updateOnSave

虽然默认是false,但是:

所以再去想办法关闭掉

通过添加 用户设置 或 工作区设置 的:

<code>"markdown.extension.toc.updateOnSave": false
</code>

然后此时:

虽然还是显示有:Table of Contents(out of date)

但是在保存时,不会把我的列表内容胡乱修改了:

【总结2】

通过去:

Code-》首选项-〉给 用户设置 或 工作区设置 加入:

<code>"markdown.extension.toc.updateOnSave": false
</code>

即可解决,在保存时,把列表内容无故修改的问题了。

转载请注明:在路上 » 【已解决】VSCode中保存Markdown时原内容被改变

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
81 queries in 0.172 seconds, using 22.13MB memory