No commit activity in last 3 years
No release in over 3 years
A rails gem to display your code properly on webpages using syntaxHighlighter
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Syntax-Highlighter-Rails

A rails gem to display your code properly on webpages using SyntaxHighlighter

Installation

Add this line to your application's Gemfile:

gem 'syntax-highlighter-rails'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install syntax-highlighter-rails

Usage

To highlight a code snippet (cpp for example) symply use the tag :

<pre class="brush: cpp">
    // Your code here
</pre>

Add the following to a javascript file :

//= require syntax-highlighter-rails/shCore
//= require syntax-highlighter-rails/shBrushCpp

Available brushes can be found here

In your page, don't forget to call :

SyntaxHighlighter.all()

Add the following to one of your css files :

 *= require syntax-highlighter-rails/shCore
 *= require syntax-highlighter-rails/shThemeDefault

Note : You can modify the theme by replacing shThemeDefault by one of the following