使用Sublime+MarkDown快速写博客
前端的开发人员应该都知道sublime的神器,今天就说说如何使用sublime结合markdown快速写博客。
添加Snippets
在使用jekyll写博客的时候开篇都需要去写一个头部,内容如下:
layout: post
title:xxxxx
date:xxxxxxx
author:xxxx
对于这个固定格式我们可以定义一个Snippets,具体的步骤如下:
在sublime中的 Tools—>Developer—>New Snippets..
<snippet> <content><![CDATA[ Hello, ${1:this} is a ${2:snippet}. ]]></content> <!-- Optional: Set a tabTrigger to define how to trigger the snippet --> <!-- <tabTrigger>hello</tabTrigger> --> <!-- Optional: Set a scope to limit where the snippet will trigger --> <!-- <scope>source.python</scope> --> </snippet>
上面代码片段包含了sublime在什么时候插入什么内,详细参考官方文档Snippets{:target=”_blank”}
content
- Hello, ${1:this} is a ${2:snippet}. 要的显示的文本
其中的${}符号是tab索引占位,${1:time},说明此处是tab第一个占位,默认值是time