index.js
function end() {
    write.apply(null, arguments)

    ended = true

    processor.process(chunks.join(''), done)

    return true

    function done(err, file) {
      var messages = file ? file.messages : []
      var length = messages.length
      var index = -1

      chunks = null

      // Trigger messages as warnings, except for fatal error.
      while (++index < length) {
        /* istanbul ignore else - shouldn’t happen. */
        if (messages[index] !== err) {
          emitter.emit('warning', messages[index])
        }
      }

      if (err) {
        // Don’t enter an infinite error throwing loop.
        global.setTimeout(function() {
          emitter.emit('error', err)
        }, 4)
      } else {
        emitter.emit('data', file.contents)
        emitter.emit('end')
      }
    }
  }
function end() {
    write.apply(null, arguments)

    ended = true

    processor.process(chunks.join(''), done)

    return true

    function done(err, file) {
      var messages = file ? file.messages : []
      var length = messages.length
      var index = -1

      chunks = null

      // Trigger messages as warnings, except for fatal error.
      while (++index < length) {
        /* istanbul ignore else - shouldn’t happen. */
        if (messages[index] !== err) {
          emitter.emit('warning', messages[index])
        }
      }

      if (err) {
        // Don’t enter an infinite error throwing loop.
        global.setTimeout(function() {
          emitter.emit('error', err)
        }, 4)
      } else {
        emitter.emit('data', file.contents)
        emitter.emit('end')
      }
    }
  }
End the writing.  Passes all arguments to a final `write`.  Starts the process, which will trigger `error`, with a fatal error, if any; `data`, with the generated document in `string` form, if succesful.  If messages are triggered during the process, those are triggerd as `warning`s.