Creating a custom jekyll-markdown snippet
In the time spent writing the previous blog post, I come to realize that I really need a snippet to help me with the highlight tags.
I’m using Jekyll to run this journal and with Jekyll comes a really cool liquid template that helps make pasting code snippets easy.
For example, to write a ruby codeblock, I’d need to:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% highlight ruby %} | |
puts "a code block here" | |
{% endhighlight %} |
To do this multiple times, it is quite a mouthful of keystrokes.
So with that, I’ve decided to write my own snippet since I’m already using snipmate-vim with my vim environment.
I created a new file in a new custom directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.vim/bundle/my-snippets/snippets/markdown.snippets | |
snippet highlight | |
{% highlight ${1} %} | |
%{2} | |
{% endhighlight %} |
and setup my vimrc to autoload the directory
# .vimrc
let g:snippets_dir="~/.vim/bundle/snipmate/snippets/, ~/.vim/bundle/my-snippets/snippets"
Now, when I open up my markdown files and type “highlight
Hope this helps someone else.