<commit_before># Rack::Codehighlighter middleware

The *Rack::Codehighlighter* is a middleware which allows for easy
connecting a code highlighter of somebody's choice to an HTML page
containing pieces of programming code. Parameters to
*Rack::Codehighlighter* are: the name of a highlighter and a
specification of how to find the pieces of code in the page.

It supports the most popular Ruby code highlighters of today:

* ultraviolet
* coderay
* syntax

To ease testing it implements *censor* highlighter.


## How it works?

*Rack::Codehighlighter* looks for code blocks to be highlighted in the HTML
produced by your application. For each block found it calls requested
highlighter.


## Installing and Usage

Install the gem with:

    sudo gem install wbzyl-rack-codehighlighter -s http://gems.github.com

### Using *rack-codehighlighter* with a Rails application

In order to use, include the following code in a Rails application
`config/environment.rb` file:

    require 'coderay'               # get one of supported highlighters 
    require 'rack/codehighlighter'
    
    Rails::Initializer.run do |config|  
      config.gem 'coderay'
      config.gem 'wbzyl-rack-codehighlighter'
        
      config.middleware.use Rack::Codehighlighter, :coderay, :element => "pre", :pattern => /\A:::(\w+)\s*\n/
    end  

### Using *rack-codehighlighter* with a Rack application

The *rack-codehighlighter* gem can be used with any Rack application,
for example with a **Sinatra** application. If your application
includes a rackup file or uses *Rack::Builder* to construct the
application pipeline, simply require and use as follows:

    gem 'coderay'       # get one of supported highlighters 
    require 'coderay'   
           
    gem 'wbzyl-rack-codehighlighter'
    require 'rack/codehighlighter'
     <commit_msg>cleaned up readme and updated todo<commit_after># Rack::Codehighlighter middleware

The *Rack::Codehighlighter* is a middleware which allows for easy
connecting a code highlighter of somebody's choice to an HTML page
containing pieces of programming code. Parameters to
*Rack::Codehighlighter* are: the name of a highlighter and a
specification of how to find the pieces of code in the page.

It supports the most popular Ruby code highlighters of today:

* ultraviolet
* coderay
* syntax

To ease testing it implements *censor* highlighter.


## How it works?

*Rack::Codehighlighter* looks for code blocks to be highlighted in the HTML
produced by your application. For each block found it calls requested
highlighter.


## Installing and Usage

Install the gem with:

    sudo gem install wbzyl-rack-codehighlighter -s http://gems.github.com

### Rails

In order to use, include the following code in a Rails application
`config/environment.rb` file:

    require 'coderay'               # get one of supported highlighters 
    require 'rack/codehighlighter'
    
    Rails::Initializer.run do |config|  
      config.gem 'coderay'
      config.gem 'wbzyl-rack-codehighlighter'
        
      config.middleware.use Rack::Codehighlighter, :coderay, :element => "pre", :pattern => /\A:::(\w+)\s*\n/
    end  

### Any Rack application

The *rack-codehighlighter* gem can be used with any Rack application,
for example with a **Sinatra** application. If your application
includes a rackup file or uses *Rack::Builder* to construct the
application pipeline, simply require and use as follows:

    gem 'coderay'       # get one of supported highlighters 
    require 'coderay'   
           
    gem 'wbzyl-rack-codehighlighter'
    require 'rack/codehighlighter'
     
{'fraction_non_alphanumeric': 0.0750625521267723, 'fraction_numerical': 0.0, 'mean_word_length': 3.672727272727273, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '568765', 'n_tokens_mistral': 1084, 'n_tokens_neox': 1027, 'n_words': 417}