     pipe = async.compose.apply(@,TRANSFORMERS)
     pipe(this,input,cb)
 
-  renderMarkedDown: (input,cb) ->
+  renderMarkedDown: (input) ->
     renderer = new marked.Renderer()
     idfy = (str) -> _s.dasherize(str.toLowerCase())
     renderer.header = (text,level) ->
       "<h#{level} id='#{idfy(text)}'>#{text}</h#{level}>"
     renderer.blockcode = (code,lang) =>
-      console.log "doing highlight"
-      result = highlight(code,lang,@hbs)
-      "<pre><code>#{result}</pre></code>"
+
+      formatter = new SourceFormatter(code,lang)
+      process = (cb) ->
+        formatter.format({},cb)
+
+      result = process.sync()
+      # console.log "md-code", result
+      @hbs.safe result
+
     marked input, {
       renderer: renderer
-      }, cb
+    }
 
 module.exports = TemplateCompiler

marked = require 'marked'

highlight = require "./highlight"
async = require 'async'
sync = require 'sync'
hbs = require("handlebars")
_s = require "underscore.string"

# Add the root parameter to helper options when it is invoked.
# @param root (Path) the root path for template compilation

  compile: (input,cb) ->
    async.waterfall [
      @renderhbs.bind(@,input)
      (input,cb) =>
        sync (=>
          @renderMarkedDown(input)
        ), cb
      @applyTransforms.bind(@)
    ], cb

