const Promise = require('bluebird')
const readFile = Promise.promisify(require('fs').readFile)
const showdown = require('showdown')

class MarkdownRenderer {
  constructor (callback) {
    this.callback = callback
    this.converter = new showdown.Converter()
  }

  loadFile (fileName) {
    return readFile(fileName, 'utf8').then((markdown) => {
      return this.load(markdown)
    })
  }

  load (markdown) {
    return this.convert(markdown).then((html) => {
      return this.callback(html)
    }).catch((error) => {
      throw error
    })
  }

  convert (markdown) {
    return Promise.promisify((markdown, callback) => {
      var html = this.converter.makeHtml(markdown)
      html = '<div class="markdown-body">' + html + '</div>'
      callback(null, html)
    })(markdown)
  }
}

exports.MarkdownRenderer = MarkdownRenderer

@@ -1,21 +1,27 @@
 const 
-P
+%7B p
 romis
-e
+ify %7D
  = requi
@@ -28,16 +28,12 @@
 re('
-bluebird
+util
 ')%0Ac
@@ -41,37 +41,13 @@
 nst 
-readFile = Promise.promisify(
+fs = 
 requ
@@ -59,18 +59,8 @@
 fs')
-.readFile)
 %0Acon
@@ -258,23 +258,69 @@
     
-return 
+fs.watch(fileName, () =%3E %7B%0A      const markdown = fs.
 readFile
 (fil
@@ -315,16 +315,20 @@
 readFile
+Sync
 (fileNam
@@ -341,32 +341,115 @@
 f8')
-.then((markdown) =%3E %7B%0A  
+%0A      Promise.resolve(this.load(markdown))%0A    %7D)%0A%0A    const markdown = fs.readFileSync(fileName, 'utf8')%0A
     
@@ -475,23 +475,16 @@
 rkdown)%0A
-    %7D)%0A
   %7D%0A%0A  l
@@ -674,24 +674,16 @@
  return 
-Promise.
 promisif

Remove promises from fs, watch loaded files