After installing the CoffeeScript brush for SyntaxHighlighter Evolved, I wanted a Clojure brush. Rather than install another plugin, I created a combined plugin, with a generic name so I can add more semi-popular languages to it, called SyntaxHighlighter Evolved: Brush Pack. I’m planning on putting it in the WordPress Plugin Directory.
To show it off, here’s a Clojure web server example, from Heroku:
(ns demo.web (:use ring.adapter.jetty)) (defn app [req] {:status 200 :headers {"Content-Type" "text/plain"} :body "Hello from Clojure!\n"}) (defn -main [] (let [port (Integer/parseInt (System/getenv "PORT"))] (run-jetty app {:port port})))
Not bad. The :keywords and curly braces, which aren’t a part of Common Lisp or Scheme, are neatly highlighted. The code sample above, by the way, gets the port from an environment variable, which is how Heroku makes it easy for applications on different platforms to adapt to their environment.
For the CoffeeScript highlighter, which I mentioned in my last post, here’s app.coffee from express-sinatra:
express = require('express') app = express.createServer() # Setup Template Engine app.register '.coffee', require('coffeekup') app.set 'view engine', 'coffee' # Setup Static Files app.use express.static(__dirname + '/public') # App Routes app.get '/', (request, response) -> response.render 'index' # Listen app.listen process.env.PORT || 8000
This one also is ready to deply on Heroku!.
Please add an issue if you’d like to see another SyntaxHighlighter brush included!