Switch to Pygments for syntax highlighting

This commit is contained in:
Rob Watson 2018-01-24 18:20:27 +00:00
parent 96a6491043
commit 1d11401a1e
7 changed files with 16 additions and 8 deletions

View File

@ -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. # 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 "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 # If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`. # uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins # gem "github-pages", group: :jekyll_plugins

View File

@ -46,9 +46,12 @@ GEM
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2) ruby_dep (~> 1.2)
mercenary (0.3.6) mercenary (0.3.6)
multi_json (1.13.1)
pathutil (0.16.1) pathutil (0.16.1)
forwardable-extended (~> 2.6) forwardable-extended (~> 2.6)
public_suffix (3.0.1) public_suffix (3.0.1)
pygments.rb (1.2.1)
multi_json (>= 1.0.0)
rb-fsevent (0.10.2) rb-fsevent (0.10.2)
rb-inotify (0.9.10) rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2) ffi (>= 0.5.0, < 2)
@ -70,6 +73,7 @@ DEPENDENCIES
jekyll-seo-tag jekyll-seo-tag
jekyll-stealthy-share! jekyll-stealthy-share!
minima (~> 2.0)! minima (~> 2.0)!
pygments.rb
tzinfo-data tzinfo-data
BUNDLED WITH BUNDLED WITH

View File

@ -24,6 +24,7 @@ permalink: /blog/:year/:month/:day/:title/
google_analytics: UA-8059487-21 google_analytics: UA-8059487-21
disqus: disqus:
shortname: netflux shortname: netflux
highlighter: pygments
# Build settings # Build settings
markdown: kramdown markdown: kramdown

View File

@ -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: 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, { use Rack::FilterParam, {
param: :client_id, param: :client_id,
if: -> (value) { should_I_do_it?(value) } 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. 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.

View File

@ -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: To install the gem, just add it to your Gemfile:
```ruby {% highlight ruby %}
group :development do group :development do
gem 'routing_report' gem 'routing_report'
end end
``` {% endhighlight %}
And discover unwanted routes and actions by running the Rake task: And discover unwanted routes and actions by running the Rake task:
```bash {% highlight bash %}
rake routing_report:run rake routing_report:run
``` {% endhighlight %}
Here is the report for the popular open source Rails app [GitLab](https://gitlab.com/gitlab-org/gitlab-ce): Here is the report for the popular open source Rails app [GitLab](https://gitlab.com/gitlab-org/gitlab-ce):

View File

@ -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: Once I'd found it, using it in the RSpec container's entrypoint script was simple:
```bash {% highlight bash %}
#!/bin/bash #!/bin/bash
set -e set -e
@ -32,4 +32,4 @@ done
bundle exec rake db:reset bundle exec rake db:reset
bundle exec rspec $@ bundle exec rspec $@
``` {% endhighlight %}

View File

@ -141,3 +141,4 @@ img.profile {
} }
} }
} }