protected function registerMarkdownEnvironment()
    {
        $app = $this->app;

        $app->singleton('commonmark.environment', function ($app) {
            $config = $app['config']['markdown'];
            $environment = Environment::createCommonMarkEnvironment();

            if ($config['configurations']) {
                $environment->mergeConfig($config['configurations']);
            }

            foreach ($config['extensions'] as $extension) {
                if (class_exists($extension)) {
                    $environment->addExtension(new $extension());
                }
            }

            return $environment;
        });

        $app->alias('commonmark.environment', Environment::class);
    }