README.rdoc in brightly-0.1.2 vs README.rdoc in brightly-0.1.3
- old
+ new
@@ -50,21 +50,24 @@
require 'rubygems'
require 'brightly'
end
run Brightly::Provider::Base
+You can easily set up a brightly app for passenger with:
+
+ brightly -p brightly
+
+Then just add the outputted config to your apache config.
+
== Client Usage
The simplest way to use brighten in a rails application is to create a helper method that can make the requests. You could likely create an ActiveResource model for this, but the data is hardly representative of a model, so a simple method call makes more sense.
-config/initializers/brightly.rb:
+A simple method can be added to your model which makes the call to Brightly:
- Brightly::Consumer.provider_url = "http://your-host.com"
- Brightly::Consumer.theme = "blackboard"
-
-In your controller or model:
-
- brighten("# Some Markdown")
+ def brighten(markdown, theme = 'blackboard')
+ Net::HTTP.post_form(URI.parse("http://127.0.0.1:4567/brighten"), {:markdown => markdown, :theme => theme}).body
+ end
Remember that you likely don't want to do this every hit to a page, markdown processing is done with RDiscount so it's fast, but code highlighting and markdown processing and the service call all adds up. Store the result, get better performance.
Cheers!