From 1d11401a1e6be679e860deda17e85ae87028cd79 Mon Sep 17 00:00:00 2001 From: Rob Watson Date: Wed, 24 Jan 2018 18:20:27 +0000 Subject: [PATCH] Switch to Pygments for syntax highlighting --- Gemfile | 2 ++ Gemfile.lock | 4 ++++ _config.yml | 1 + _posts/2018-01-18-rack-filter-param.md | 4 ++-- _posts/2018-01-19-routing-report.md | 8 ++++---- _posts/2018-01-23-pg_isready.md | 4 ++-- assets/main.scss | 1 + 7 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index 1ccd99d..5b89c3a 100644 --- a/Gemfile +++ b/Gemfile @@ -13,6 +13,8 @@ gem "jekyll", "~> 3.6.2" # This is the default theme for new Jekyll sites. You may change this to anything you like. gem "minima", "~> 2.0", git: 'https://github.com/rfwatson/minima-2col' +gem "pygments.rb" + # If you want to use GitHub Pages, remove the "gem "jekyll"" above and # uncomment the line below. To upgrade, run `bundle update github-pages`. # gem "github-pages", group: :jekyll_plugins diff --git a/Gemfile.lock b/Gemfile.lock index 97f5464..f3975df 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -46,9 +46,12 @@ GEM rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) mercenary (0.3.6) + multi_json (1.13.1) pathutil (0.16.1) forwardable-extended (~> 2.6) public_suffix (3.0.1) + pygments.rb (1.2.1) + multi_json (>= 1.0.0) rb-fsevent (0.10.2) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) @@ -70,6 +73,7 @@ DEPENDENCIES jekyll-seo-tag jekyll-stealthy-share! minima (~> 2.0)! + pygments.rb tzinfo-data BUNDLED WITH diff --git a/_config.yml b/_config.yml index 1bae104..9b07fc0 100644 --- a/_config.yml +++ b/_config.yml @@ -24,6 +24,7 @@ permalink: /blog/:year/:month/:day/:title/ google_analytics: UA-8059487-21 disqus: shortname: netflux +highlighter: pygments # Build settings markdown: kramdown diff --git a/_posts/2018-01-18-rack-filter-param.md b/_posts/2018-01-18-rack-filter-param.md index fead553..22ff02b 100644 --- a/_posts/2018-01-18-rack-filter-param.md +++ b/_posts/2018-01-18-rack-filter-param.md @@ -12,12 +12,12 @@ Hot on the heels of [thes](/blog/2018/01/16/thes-gem/) is another Ruby gem: this The middleware needs only the most minimal configuration. For example, here it is being configured to strip the `client_id` parameter from incoming requests, based on some assumed application-level logic: -```ruby +{% highlight ruby %} use Rack::FilterParam, { param: :client_id, if: -> (value) { should_I_do_it?(value) } } -``` +{% endhighlight %} When the application method `should_I_do_it?` returns a truthy value, the `client_id` parameter is stripped from the request, which is then passed upstream. diff --git a/_posts/2018-01-19-routing-report.md b/_posts/2018-01-19-routing-report.md index 3287ab4..e422aa8 100644 --- a/_posts/2018-01-19-routing-report.md +++ b/_posts/2018-01-19-routing-report.md @@ -22,17 +22,17 @@ The gem adds a single Rake task to your Rails application. When you run the task To install the gem, just add it to your Gemfile: -```ruby +{% highlight ruby %} group :development do gem 'routing_report' end -``` +{% endhighlight %} And discover unwanted routes and actions by running the Rake task: -```bash +{% highlight bash %} rake routing_report:run -``` +{% endhighlight %} Here is the report for the popular open source Rails app [GitLab](https://gitlab.com/gitlab-org/gitlab-ce): diff --git a/_posts/2018-01-23-pg_isready.md b/_posts/2018-01-23-pg_isready.md index f96ee05..3c6c6b4 100644 --- a/_posts/2018-01-23-pg_isready.md +++ b/_posts/2018-01-23-pg_isready.md @@ -18,7 +18,7 @@ While researching the most appropriate solution, I discovered a useful tool. [`p Once I'd found it, using it in the RSpec container's entrypoint script was simple: -```bash +{% highlight bash %} #!/bin/bash set -e @@ -32,4 +32,4 @@ done bundle exec rake db:reset bundle exec rspec $@ -``` +{% endhighlight %} diff --git a/assets/main.scss b/assets/main.scss index 25f4213..df487f8 100644 --- a/assets/main.scss +++ b/assets/main.scss @@ -141,3 +141,4 @@ img.profile { } } } +