Redcarpet and Pygments
Decided on Redcarpet over RedCloth and BlueCloth. Redcarpet has a lot more
flexibility in that it allows you to modify post processing of certain areas.
I was interested in fenced code blocks. This is where you want to specify
blocks of code delimited by ```
. I want to add syntax highlighting, which is
where pyments come in.
To set up Redcarpet.
gem install redcarpet
- Edit apps/helpers/application_helper.rb
- Use it in the view
To set up pygments
gem install pygments.rb
- Modify apps/helpers/application_helper.rb
I didn’t have too much trouble getting this installed. It was hard to detect
that this was working because it doesn’t specify the css files so the processed
text didn’t show colors. I installed py33-pygments (sudo port install
py33-pygments
) so I can run pygmentize-3.3
. Here’s the command that
generated my css files:
To get a list of styles you can do:
My site is still not ready for prime time. Need to look into bootstrap to add good looking css. Found out that Github uses pygments so it would be nice to have my code look like Github’s.