Exemple #1
0
 public static MvcHtmlString RenderMarkdown(this HtmlHelper helper, string path)
 {
     var absPath = VirtualPathUtility.ToAbsolute(path);
         var mappedPath = helper.ViewContext.HttpContext.Server.MapPath(absPath);
         var fileText = File.ReadAllText(mappedPath);
         var ms = new MarkdownService(null);
         var mdText = ms.ToHtml(fileText);
         return new MvcHtmlString(mdText);
 }
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);

            MarkdownService = new MarkdownService(new FileBackedGithubUrlContentProvider(ConfigurationManager.AppSettings["WikiMarkdownUrl"], ConfigurationManager.AppSettings["WikiMarkdownBackupDirectory"]));
        }