 
   Object.assign({}, data, config)
 
+processPaths = (text, outputDir, projectDirectoryPath, rootDirectoryPath)->
+  match = null
+  offset = 0
+  output = ''
+
+  resolvePath = (src)->
+    if src.startsWith('http://') or
+       src.startsWith('https://') or
+       src.startsWith('atom://') or
+       src.startsWith('file://') or
+       src.startsWith('#')
+      return src
+    else if src.startsWith('/')
+      return path.relative(outputDir, path.resolve(projectDirectoryPath, '.'+src))
+    else # ./test.png or test.png
+      return path.relative(outputDir, path.resolve(rootDirectoryPath, src))
+
+  # replace path in ![](...) and []()
+  r = /(\!?\[.*?]\()([^\)|^'|^"]*)(.*?\))/gi
+  text = text.replace r, (whole, a, b, c)->
+    if b[0] == '<'
+      b = b.slice(1, b.length-1)
+      a + '<' + resolvePath(b.trim()) + '> ' + c
+    else
+      a + resolvePath(b.trim()) + ' ' + c
+
+  # replace path in tag
+  r = /(<[img|a|iframe].*?[src|href]=['"])(.+?)(['"].*?>)/gi
+  text = text.replace r, (whole, a, b, c)->
+    a + resolvePath(b) + c
+
+  text
 ###
 title
 author


  console.log args.join(' ')

  program = execFile 'pandoc', args
  program.stdin.end(text)

  program.on 'exit', ()->
    atom.notifications.addInfo "File #{path.basename(outputFilePath)} was created", detail: "path: #{outputFilePath}"

  program.on 'error', (err)->
    throw err
  ###
  , (error)->
    throw error if error
    atom.notifications.addInfo "File #{path.basename(outputFilePath)} was created", detail: "path: #{outputFilePath}"
  ###
module.exports = pandocConvert

path = require 'path'
fs = require 'fs'
{execFile} = require 'child_process'
matter = require 'gray-matter'
# temp = require 'temp'
{parseMD} = require './md'

getFileExtension = (documentType)->
  if documentType == 'pdf_document'
