public function getFormatter()
    {
        $fmt = $this->settings->format;
        $formatter = null;
        if (!is_string($fmt) && is_subclass_of($fmt, 'Luminous\\Formatters\\Formatter')) {
            $formatter = clone $fmt;
        } elseif ($fmt === 'html') {
            $formatter = new HtmlFormatter();
        } elseif ($fmt ===  'html-inline') {
            $formatter = new InlineHtmlFormatter();
        } elseif ($fmt ===  'html-full') {
            $formatter = new FullPageHtmlFormatter();
        } elseif ($fmt === 'latex') {
            $formatter = new LatexFormatter();
        } elseif ($fmt === 'ansi') {
            $formatter = new AnsiFormatter();
        } elseif ($fmt ===  null || $fmt === 'none') {
            $formatter = new IdentityFormatter();
        }

        if ($formatter === null) {
            throw new Exception('Unknown formatter: ' . $this->settings->format);
            return null;
        }
        $this->setFormatterOptions($formatter);
        return $formatter;
    }