Skip to content
Syntax Highlighter for Middleman used on
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Iniital extension Oct 27, 2017
lib Fixes the rouge require May 14, 2019
Gemfile Iniital extension Oct 27, 2017
Rakefile Iniital extension Oct 27, 2017
middleman-vegas.gemspec Updates the gemspec for release Nov 3, 2017


This brings the great styles and metadata support found in the Octopress Code Highlighter to Middleman. This has some additional features beyond that to support the work being done for Habitat.


Add this line to your application's Gemfile:

gem 'middleman-vegas'

And then execute:

$ bundle

Or install it yourself as:

$ gem install middleman-vegas


Activate it to the Middleman config.rb:

activate :vegas


You can define code fences as you would normally. These code fences have support for the languages defined in rouge.

Define a code fence with a language.


Define a code fence for a language with the addition of a title.

```lang title

Define a code fence for a language with additional metadata

```lang [metadata]

The additional metadata that can be specified:

Metadata Example Description
lang ruby Used by the syntax highlighter. Passing 'plain' disables highlighting.
title title:"Figure 1.A" Add a figcaption title to your code block.
url url:"" No default value
link_text link_text:"Download" Text for the link, default: "link"
linenos linenos:true Enables line numbering
start start:5 Start the line numbering at the given value.
mark mark:1-4,8 Highlight lines of code. This example marks lines 1,2,3,4 and 8
class class:"css example" Add CSS class names to the code <figure> element


After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to


Bug reports and pull requests are welcome on GitHub at This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.


The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Middleman::Octopress::Code::Highlighter project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

You can’t perform that action at this time.