         @createMarkdownPreviewView(editorId: path.substring(7))
       else
         @createMarkdownPreviewView(filePath: path)
+
+  deactivate: ->
+    @disposables.dispose()
 
   createMarkdownPreviewView: (state) ->
     if state.editorId or fs.isFileSync(state.filePath)

url = require 'url'
fs = require 'fs-plus'

MarkdownPreviewView = null
renderer = null

        atom.config.set(keyPath, not atom.config.get(keyPath))

    previewFile = @previewFile.bind(this)
    for extension in ['markdown', 'md', 'mdown', 'mkd', 'mkdown', 'ron', 'txt']
      # FIXME: This doesn't work. Individual elements in the Tree View do not get focus
      # so this selector never matches.
      @disposables.add atom.commands.add ".tree-view .file .name[data-name$=\\.#{extension}]",
        'markdown-preview:preview-file', previewFile

    @disposables.add atom.workspace.addOpener (uriToOpen) =>
      [protocol, path] = uriToOpen.split('://')
      return unless protocol is 'markdown-preview'

