/// <summary> /// Adds a folder to the list of folders that are to be /// processed by this middleware. /// </summary> /// <param name="path">The path to work on. Examples: /docs/ or /classes/docs/.</param> /// <param name="viewTemplate">Path to a View Template. Defaults to: ~/Views/__MarkdownPageTemplate.cshtml</param> /// <param name="processMdFiles">Process files with an .md extension</param> /// <param name="processExtensionlessUrls">Process extensionless Urls as Markdown. Assume matching .md file is available that holds the actual Markdown text</param> /// <returns></returns> public MarkdownProcessingFolder AddMarkdownProcessingFolder(string path, string viewTemplate = null, bool processMdFiles = true, bool processExtensionlessUrls = true) { if (!path.StartsWith("/")) { path = "/" + path; } if (!path.EndsWith("/")) { path = "/" + path + "/"; } var folder = new MarkdownProcessingFolder() { RelativePath = path, ProcessMdFiles = processMdFiles, ProcessExtensionlessUrls = processExtensionlessUrls }; if (!string.IsNullOrEmpty(viewTemplate)) { folder.ViewTemplate = viewTemplate; } MarkdownProcessingFolders.Add(folder); return(folder); }
/// <summary> /// Adds a url masked folder to the list of folders that are to be /// processed by this middleware. /// </summary> /// <param name="path">The path to work on. Examples: /docs/ or /classes/docs/.</param> /// <param name="viewTemplate">Path to a View Template. Defaults to: ~/Views/__MarkdownPageTemplate.cshtml</param> /// <param name="processMdFiles">Process files with an .md extension</param> /// <param name="processExtensionlessUrls">Process extensionless Urls as Markdown. Assume matching .md file is available that holds the actual Markdown text</param> /// <returns></returns> public MarkdownProcessingFolder AddMarkdownMaskedProcessingFolder(string urlMask, string filePath, string viewTemplate = null, bool processMdFiles = true, bool processExtensionlessUrls = true) { if (!filePath.StartsWith("/")) { filePath = "/" + filePath; } if (!filePath.EndsWith("/")) { filePath = "/" + filePath + "/"; } if (!urlMask.StartsWith("/")) { urlMask = "/" + urlMask; } if (!urlMask.EndsWith("/")) { urlMask = "/" + urlMask + "/"; } var folder = new MarkdownProcessingFolder() { RelativePath = filePath, ProcessMdFiles = processMdFiles, ProcessExtensionlessUrls = processExtensionlessUrls, UrlPathMask = urlMask }; if (!string.IsNullOrEmpty(viewTemplate)) { folder.ViewTemplate = viewTemplate; } MarkdownProcessingFolders.Add(folder); return(folder); }