VScode配置markdown自定義代碼模板


起因

在寫博客的過程中有的話總是會反復的說,就是這一句(逃

所以考慮有沒有直接能生成這段話的模板,防止每次發博客的時候都要去復制粘貼

配置

因為現在typro需要收費了,所以我在電腦上寫博客現在都是用VScode+markdown插件,這里配置廢話模板當然也是在VScode上進行配置

打開VScode的settings.json,添加

"[markdown]":  {
        "editor.quickSuggestions": true
    }


保存之后打開 文件->首選項 -> 用戶片段

輸入並選擇markdown

這里已經給了我們一個example,在body里面編寫我們的模板

比如這里我編寫的就是

{
	// Place your snippets for markdown here. Each snippet is defined under a snippet name and has a prefix, body and 
	// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
	// same ids are connected.
	// Example:
	"Print to console": {
		"prefix": "end",
		"body": [
			"## END ",
			" ",
			"建了一個微信的安全交流群,歡迎添加我微信備注`進群`,一起來聊天吹水哇,以及一個會發布安全相關內容的公眾號,歡迎關注 :)",
			" ",
			"<div>",
			"    <img  alt=\"GIF\" src=\"https://springbird.oss-cn-beijing.aliyuncs.com/img/mmqrcode1632325540724.png\"  width=\"280px\" />",
			"    <img  alt=\"GIF\" src=\"https://springbird.oss-cn-beijing.aliyuncs.com/img/qrcode_for_gh_cead8e1080d6_344.jpg\"  width=\"280px\" />",
			"</div>"
		],
		"description": "end output"
	}
}

保存即可

效果

創建一個新的markdown文件,輸入 上面prefix對應的內容,這里我對應的就是end

可以看到我輸入end之后VScode出現了提示,回車或者tab即可

模板內容成功生成

參考鏈接

END

建了一個微信的安全交流群,歡迎添加我微信備注進群,一起來聊天吹水哇,以及一個會發布安全相關內容的公眾號,歡迎關注 😃

GIF GIF


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM