How to use other middleware, Rack::Pygmentize

79 views
Skip to first unread message

Victor Tolbert

unread,
Jun 28, 2011, 5:51:15 PM6/28/11
to middlem...@googlegroups.com
Hi,

I'd like to use [Rack::Pygmentize][1] with middleman.

The usage instructions seem pretty clear...

* Just add `use Rack::Pygmentize` to your `config.ru`. See the
[example][2] in the `/examples` directory.

I have the prerequisites...

* [Pygments][3] is installed and the `pygmentize` executable is
available in my `PATH`.

My `config.ru`:

require 'rubygems'
require 'middleman'

use Rack::Pygmentize
run Middleman::Server

By the way, middleman is awesome! Love it.

Thanks,
Victor

[1]:https://github.com/injekt/rack-pygmentize
[2]:https://github.com/inject/rack-pygmentize/blob/master/examples/rack-pygmentize.rb
[3]:https://pygments.org

Thomas Reynolds

unread,
Jun 28, 2011, 5:54:16 PM6/28/11
to middlem...@googlegroups.com
config.ru is only for hosting the site in a static fashion.

If you want to apply middleware directly against mm-server and have it work in mm-build, you'll need to place it in config.rb

Same syntax

require "rack/pygmentize"
use Rack::Pygmentize

See this example of how I use CodeRay (a pure ruby syntax highlighter):

-Thomas

Victor Tolbert

unread,
Jun 28, 2011, 6:35:03 PM6/28/11
to middlem...@googlegroups.com
Cool. Thanks! Maybe I'll just follow the example and just use CodeRay.

Victor

Reply all
Reply to author
Forward
0 new messages