Skip to content

Linuus/middleman-rouge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Middleman::Rouge

The middleman-rouge gem adds syntax highlighting for Middleman using the Rouge library and Redcarpet markdown engine.

Installation

Add these lines to your application's Gemfile:

gem 'middleman-rouge'
gem "redcarpet"

And then execute:

$ bundle

Or install it yourself as:

$ gem install middleman-rouge
$ gem install redcarpet

Then add this to your config.rb file:

###
# Markdown
###

set :markdown_engine, :redcarpet
set :markdown, :fenced_code_blocks => true, :smartypants => true

###
# Code highlighting
###

activate :rouge_syntax

Also, you need to add a CSS file to add some coloring. Rouge supports stylesheets created for Pygment. A nice collection of CSS files can be found here: https://github.com/richleland/pygments-css. You may need to configure the CSS class to have .highlight as base class.

Usage

You can add a nice code block like this:

```ruby
def index
  @cars = Car.all

  respond_to do |format|
    format.html # index.html.erb
    format.json { render json: @cars }
  end
end
```

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

Add syntax highlighting to Middleman

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages