public MarkdownPageProcessorController(
     IWebHostEnvironment hostingEnvironment,
     MarkdownConfiguration config)
 {
     MarkdownProcessorConfig = config;
     this.hostingEnvironment = hostingEnvironment;
 }
Example #2
0
        /// <summary>
        /// Configure the MarkdownPageProcessor in Startup.ConfigureServices.
        /// </summary>
        /// <param name="services"></param>
        /// <param name="configAction"></param>
        /// <returns></returns>
        public static IServiceCollection AddMarkdown(this IServiceCollection services,
                                                     Action <MarkdownConfiguration> configAction = null)
        {
            var config = new MarkdownConfiguration();

            if (configAction != null)
            {
                configAction.Invoke(config);
            }


            if (config.ConfigureMarkdigPipeline != null)
            {
                MarkdownParserMarkdig.ConfigurePipelineBuilder = config.ConfigureMarkdigPipeline;
            }

            config.MarkdownProcessingFolders =
                config.MarkdownProcessingFolders
                .OrderBy(f => f.RelativePath)
                .ToList();

            services.AddSingleton(config);

            return(services);
        }
        /// <summary>
        /// Configure the MarkdownPageProcessor in Startup.ConfigureServices.
        /// </summary>
        /// <param name="services"></param>
        /// <param name="configAction"></param>
        /// <returns></returns>
        public static IServiceCollection AddMarkdown(this IServiceCollection services,
                                                     Action <MarkdownConfiguration> configAction = null)
        {
            var config = new MarkdownConfiguration();

            if (configAction != null)
            {
                configAction.Invoke(config);
            }

            MarkdownComponentState.Configuration = config;

            MarkdownParserBase.HtmlSanitizeTagBlackList = config.HtmlTagBlackList;

            if (config.ConfigureMarkdigPipeline != null)
            {
                MarkdownParserMarkdig.ConfigurePipelineBuilder = config.ConfigureMarkdigPipeline;
            }

            config.MarkdownProcessingFolders =
                config.MarkdownProcessingFolders
                .OrderBy(f => f.RelativePath)
                .ToList();

            services.AddSingleton(config);

            // We need access to the HttpContext for Filename resolution
            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();

            return(services);
        }
 public MarkdownPageProcessorMiddleware(RequestDelegate next,
                                        MarkdownConfiguration configuration,
                                        IHostingEnvironment env)
 {
     _next          = next;
     _configuration = configuration;
     _env           = env;
 }
Example #5
0
 public MarkdownPageProcessorMiddleware(RequestDelegate next,
                                        MarkdownConfiguration configuration,
                                        IWebHostEnvironment _env
                                        )
 {
     _next          = next;
     _configuration = configuration;
     this._env      = _env;
 }
        public MarkdownPageProcessorMiddleware(RequestDelegate next,
                                               MarkdownConfiguration configuration,
#if NETCOREAPP2_1
                                               IHostingEnvironment _env