Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

docs

  • Loading branch information...
commit ff233fda906092a1476e7d2e05a55ba91932d382 1 parent 065baac
@zzak authored
Showing with 30 additions and 16 deletions.
  1. +29 −15 README.md
  2. +1 −1  glorify.gemspec
View
44 README.md
@@ -2,8 +2,11 @@
Sinatra helper to parse markdown with syntax highlighting like the pros
-Renders via redcarpet with syntax highlighting thanks to [pygments.rb](https://github.com/tmm1/pygments.rb). Able to use
-fenced code blocks like github, and includes a default pygments stylesheet.
+Renders markdown via redcarpet with syntax highlighting thanks to
+[pygments.rb](https://github.com/tmm1/pygments.rb).
+
+Able to use fenced code blocks like github, and includes a default pygments
+stylesheet.
## install
@@ -19,28 +22,36 @@ gem 'sinatra'
gem 'glorify'
```
-## usage
+## using `Glorify::Template`
+
+glorify comes with a tilt template for rendering markdown.
+
+this allows you to override the default markdown renderer and use redcarpet2
+with pygments.rb to highlight any code blocks within your view.
-given the following `markdown` example
+in order to do this, you will need to prefer the template class.
- # a sip of glory
+```ruby
+Tilt.prefer Sinatra::Glorify::Template
+```
- providing a sinatra helper, glorify lets you parse markdown with ease.
+then any views that render `markdown` will use Glorify::Template instead.
- you can even parse code blocks, in any language you'd like. just like you can
- with github flavored markdown. because glorify uses much of the same technology
- as github, you can highlight code from nearly any language, without any extra
- dependencies.
+```ruby
+register Sinatra::Glorify
+get '/' do
+ markdown :a_view_with_code_blocks
+end
+```
- the snippet below will render a bit of some ruby with syntax highlighting.
+## using the helper
- ```ruby
- ['toast', 'cheese', 'wine'].each { |food| print food.capitalize }
- ```
+if you want to stick with your current renderer and just render some code
+blocks within your view, use the `glorify` helper method.
### classical app
-simply `require 'glorify'` to use with a classic style sinatra app.
+simply `require 'glorify'` to use the helper with a classic style sinatra app.
```ruby
require 'sinatra'
@@ -85,6 +96,9 @@ this is just a simple `erb` template, but you get the idea.
</html>
```
+the default pygments stylesheet that comes with glorify is available at the
+`/pygments.css` route
+
### on heroku
to make this work on heroku you'll have to use python2.6
View
2  glorify.gemspec
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.email = ["zachary@zacharyscott.net"]
s.homepage = "http://github.com/zzak/glorify"
s.summary = %q{Sinatra helper to parse markdown with syntax highlighting like the pros}
- s.description = %q{Renders via redcarpet with syntax highlighting thanks to pygments.rb. Able to use fenced code blocks like github, and includes a default pygments stylesheet.}
+ s.description = %q{Renders markdown via redcarpet with syntax highlighting thanks to pygments.rb. Able to use fenced code blocks like github, and includes a default pygments stylesheet.}
s.files = `git ls-files`.split("\n")
s.require_paths = ["lib"]
Please sign in to comment.
Something went wrong with that request. Please try again.