docs: function(view, locals, isAsync) {
      if (typeof locals === 'boolean') {
        isAsync = locals;
        locals = {};
      }
  
      // get the engine to use
      locals = locals || {};
      var engine = this.engine(locals.engine ? locals.engine : view.engine);
  
      if (typeof engine === 'undefined') {
        throw this.error('compile', 'engine', view);
      }
      if (!engine.hasOwnProperty('compile')) {
        throw this.error('compile', 'method', engine);
      }
  
      view.ctx('compile', locals);
      // build the context to pass to the engine
      var ctx = view.context(locals);
      // apply layout
      view = this.applyLayout(view, ctx);
      // handle `preCompile` middleware
      this.handleView('preCompile', view, locals);
  
      // Bind context to helpers before passing to the engine.
      this.bindHelpers(view, locals, ctx, (locals.async = isAsync));
      var settings = lazy.extend({}, ctx, locals);
  
      // compile the string
      view.fn = engine.compile(view.content, settings);
      // handle `postCompile` middleware
      this.handleView('postCompile', view, locals);
      return view;
    }