Pavel Nasovich's Blog

The Moderately Enthusiastic Programmer

Today I Learned: Homebrew, Jekyll and Liquid

Posted at — Nov 8, 2015

I’ve decide to start writing in my blog.. And I faced with several issues and strange things in the tools and frameworks.

How-to install Sublime Text 3 with Homebrew

It’s pretty easy to install it but for man who is moving from Windows to Mac OS it is rather hard to change mind.

I did not have brew cask installed so I had to install it first, so these were the steps I followed:

brew install caskroom/cask/brew-cask
brew tap caskroom/versions
brew cask install sublime-text3

Jekyll and Liquid

How do I chain if statements in Jekyll?

In Jekyll/Liquid else-if is spelt elsif, i.e.:

{% raw %}
{% if post.category == "speaking" %}
  <i class="fa fa-microphone"></i>
{% elsif post.category == "til" %}
  <i class="fa fa-hand-spock-o"></i>
{% else %}
  <i class="fa fa-hand-paper-o"></i>
{% endif %}
{% endraw %}

How to use Jekyll code in (inline) code highlighting?

Use raw and endraw tags in highlighting block.

Cannot load such file – jekyll-sitemap (LoadError)

It works using bundle exec. Probably problem described here

bundle exec jekyll build
bundle exec jekyll serve

Bundle command not found mac

Use gem install bundler, Luke

Reinstall nuget packages in project

Ever been in a situation where you wanted to have all nuget packages of a project to be kind of “refreshed”?

Update-Package –reinstall -project MySuperProject.Web

How I Add a Table of Contents to Jekyll Blog

For my Jekyll blog I want to add a table of contents to some of my larger posts so readers have an overview of the post content and may click links to jump to sections which interest them most. I’d like Jekyll to automatically generate the markup for the table of contents based off the headers in the post.

Here’s how I set up Jekyll to get my table of contents (toc) feature.

By default, Jekyll on Github pages is configured to use Kramdown to parse and convert Markdown1 to html format for blog post pages. Jekyll’s markdown conversion option is set in the _config.yml file like this:

markdown: kramdown

Implementing the auto table of contents feature is almost as easy as the necessary configuration.

Here’s the markup I use to add tocs to my posts:


comments powered by Disqus