/// <summary> /// Transforms a markdown file into valid HTML and create a HTML file into the local folder in ApplicationData. /// </summary> /// <param name="markdownFilePath"> The path of the markdown file.</param> public void TransformToHtml(string markdownFilePath) { if (!File.Exists(markdownFilePath)) { throw new FileNotFoundException(string.Format("Could not find the file at the path : '{0}'", markdownFilePath)); } if (!Directory.Exists(PathDocuPanelAppData)) { Directory.CreateDirectory(PathDocuPanelAppData); } // Initalize the MarkdownDeep object. var md = new Markdown { ExtraMode = true, SafeMode = true, AutoHeadingIDs = true }; // Read the markdown file and transform the content into HTML. var content = File.ReadAllText(markdownFilePath); var transformed = md.Transform(content); var wrapped = MarkupHelper.WrapHtmlBody(transformed); // Create or override a HTML file. var htmlFilePath = this.ConvertMarkdownFilePathToHtmlFilePath(markdownFilePath); File.WriteAllText(htmlFilePath, wrapped); }