static void Main(string[] args) { if (args.Length == 0) { DisplayHelp(); return; } else if (args.Length > 2) { Console.WriteLine("Invalid number of arguments. Usage:\n"); DisplayHelp(); return; } try { Markdown m = new Markdown(); string sourceDirectory = args[0]; string destinationDirectory = (args.Length == 2) ? args[1] : sourceDirectory; foreach (string file in Directory.GetFiles(sourceDirectory)) { string fileName = Path.GetFileNameWithoutExtension(file); string transformedText = m.Transform(File.ReadAllText(file)); string newFile = Path.Combine(sourceDirectory, fileName + ".html"); File.WriteAllText(newFile, transformedText); } Console.WriteLine("Conversion complete."); } catch (Exception ex) { Console.WriteLine("Errors occured during conversion: {0}", ex.Message); } }
public string Render(string content) { var renderedContent = new Markdown().Transform(content); var htmlMessage = htmlTemplate.Replace("[MessageBody]", renderedContent); return htmlMessage; }
public static string MarkdownEncode(this string s) { var md = new MarkdownSharp.Markdown(); md.CodeClass = " class=\"prettyprint\""; return(md.Transform(s)); }
public void IndexReturnsCorrectViewResult( HttpContextBase httpContext, ControllerContext controllerContext, HomeController sut) { // Arrange controllerContext.HttpContext = httpContext; sut.ControllerContext = controllerContext; const string readmeFilePath = "README.md"; Mock.Get(httpContext).Setup(x => x.Server.MapPath("~/bin/README.md")).Returns(readmeFilePath); string markdown; using (var reader = new StreamReader(readmeFilePath)) { markdown = reader.ReadToEnd(); } var html = new Markdown().Transform(markdown); // Act var actual = sut.Index(); // Assert var viewResult = Assert.IsAssignableFrom<ViewResult>(actual); Assert.Empty(viewResult.ViewName); Assert.Equal(html, viewResult.Model); }
public DocumentParser(ITemplate template) { Ensure.ArgumentNotNull(template, "template"); _template = template; _markdown = new Markdown(); }
private void MarkDownTextBox_Load(object sender, EventArgs e) { if(this.DesignModeAtAll()) return; var markdownTransformer = new Markdown(); _htmlLabel.HTML = markdownTransformer.Transform(_markdown); }
private string GetContent() { var md = new Markdown(new MarkdownOptions { AutoHyperlink = true }); // Code is converted to <pre><code>, I just want the code tag: var html = md.Transform(_content).Replace("<pre><code>", "<code>").Replace("</code></pre>", "</code>"); return html; }
public MarkDownService(Manager man) : base(man) { Markdown = new Markdown(); Markdown.AutoHyperlink = true; Markdown.AutoNewLines = true; }
protected override void StartCompiler(string source) { if (_compiler == null) _compiler = CreateCompiler(); string result = _compiler.Transform(source); if (_browser != null) { string html = String.Format(CultureInfo.InvariantCulture, @"<!DOCTYPE html> <html lang=""en"" xmlns=""http://www.w3.org/1999/xhtml""> <head> <meta charset=""utf-8"" /> <title>Markdown Preview</title> {0} </head> <body>{1}</body></html>", GetStylesheet(), result); _browser.NavigateToString(html); } // NOTE: Markdown files are always compiled for the Preview window. // But, only saved to disk when the CompileEnabled flag is true. // That is why the following if statement is not wrapping this whole method. if (IsSaveFileEnabled) { OnCompilationDone(result.Trim(), Document.FilePath); } }
public static void SendEmail(Suggestion suggestion) { var markdown = new Markdown(); var appName = WebConfigurationManager.AppSettings["AppName"]; var appUrl = WebConfigurationManager.AppSettings["AppUrl"]; var smtpServer = WebConfigurationManager.AppSettings["SmtpServer"]; var fromAddress = WebConfigurationManager.AppSettings["EmailFrom"]; var toAddress = WebConfigurationManager.AppSettings["EmailTo"]; var subject = string.Format("{0}: {1}", appName, suggestion.Title); var body = string.Format(@"<p>""{0}"" has been submitted to {1}.</p> {2} <p>You can view the suggestion <a href=""{3}Suggestions/View/{4}"">here</a>.</p>", suggestion.Title, appName, markdown.Transform(suggestion.Body), appUrl, suggestion.Id); var message = new MailMessage(fromAddress, toAddress) { Subject = subject, Body = body, IsBodyHtml = true }; var client = new SmtpClient(smtpServer); client.Send(message); }
private void ShowReadme() { var source = File.ReadAllText(_readmePath); var mark = new Markdown(_options); var headerHtml = @"<!DOCTYPE html> <head> <meta charset='utf-8'> <link rel='stylesheet' type='text/css' href=' " + _stylePath + @"' /> </head> <body> "; const string footerHtml = @"</body>"; var htmlString = headerHtml + mark.Transform(source) + footerHtml; WbReadme.NavigateToString(htmlString); }
public static Post Parse(string fileData) { var lines = fileData.Split(new[] { Environment.NewLine }, StringSplitOptions.None); var metadata = new Dictionary<string, string>(); if (lines.Any() && lines[0] != "---") { return null; } var ii = 1; for (; ii < lines.Length; ii++ ) { if (lines[ii] == "---") { break; } var parts = lines[ii].Split(':'); metadata.Add(parts[0].Trim(), parts[1].Trim()); } var content = string.Join(Environment.NewLine, lines.Skip(ii + 1).ToArray()); var md = new Markdown(); return new Post { Title = metadata["title"], PublishDate = DateTime.Parse(metadata["date"]), Content = md.Transform(content) }; }
private string transform(string text) { if (string.IsNullOrEmpty(text)) return string.Empty; var parser = new Markdown(); parser.ExtendWith(new StatefulCheckboxPattern()); var t = parser.Transform(text); //prevent html from being replaced by wikiwords var htmlTags = new Queue<string>(); t = _htmlTagsRegex.Replace(t, m => { htmlTags.Enqueue(m.Groups[0].Value); return _emaPlaceholder; }); //don't extend markdown with this pattern because it will destroy links t = new WikiWordsPattern().Transform(t); return _htmlTagsRegex.Replace(t, m => { if (m.Groups[0].Value == _emaPlaceholder) { return htmlTags.Dequeue(); } else { //new wikiword link return m.Groups[0].Value; } }); }
public void Process(RenderFieldArgs args) { Assert.ArgumentNotNull(args, "args"); if (!string.IsNullOrEmpty(args.FieldValue)) { args.Result.FirstPart = args.FieldValue; } else { args.Result.FirstPart = args.Item[args.FieldName]; } if (args.FieldTypeKey == "rich text") { WordFieldValue wordFieldValue = WordFieldValue.Parse(args.Result.FirstPart); if (wordFieldValue.BlobId != ID.Null) { args.Result.FirstPart = wordFieldValue.GetHtmlWithStyles(); } } if (args.FieldTypeKey == "markdownfield") { var markdown = new Markdown(); args.Result.FirstPart = markdown.Transform(args.FieldValue); } }
public string Process(string input) { var options = new MarkdownOptions(); var markdown = new Markdown(); var output = markdown.Transform(input); return output; }
private static IEnumerable<TestCaseData> GetTests() { Markdown m = new Markdown(); Assembly assembly = Assembly.GetAssembly(typeof(BaseTest)); string namespacePrefix = String.Concat(assembly.GetName().Name, '.', folder); string[] resourceNames = assembly.GetManifestResourceNames(); Func<string, string> getResourceFileContent = filename => { using (Stream stream = assembly.GetManifestResourceStream(filename)) { if (stream == null) return null; using (StreamReader streamReader = new StreamReader(stream)) return streamReader.ReadToEnd(); } }; return from name in resourceNames // Skip resource names that aren't within the namespace (folder) we want // and doesn't have the extension '.html'. where name.StartsWith(namespacePrefix) && name.EndsWith(".html") let actualName = Path.ChangeExtension(name, "text") let actualContent = getResourceFileContent(actualName) let actual = Program.RemoveWhitespace(m.Transform(actualContent)) let expectedContent = getResourceFileContent(name) let expected = Program.RemoveWhitespace(expectedContent) select new TestCaseData(actualName, name, actual, expected); }
private static string MarkdownReplace(string text) { if (string.IsNullOrEmpty(text)) return string.Empty; var markdown = new MarkdownSharp.Markdown(new MarkdownOptions { AutoNewLines = false }); return markdown.Transform(text); }
public MDView(IStatusbarService statusbar) { _md = new Markdown(); this._statusbar = statusbar; InitializeComponent(); textEditor.TextArea.Caret.PositionChanged += Caret_PositionChanged; }
public string Execute(string source, IDictionary<string, object> arguments) { var markdown = new Markdown(); string output = markdown.Transform(source); return output; }
public string ToHtml(MarkdownDocument doc, UrlHelper urlHelper) { var html = new Markdown(new MarkdownOptions()).Transform(doc.Markdown); const string internalLinkPattern = @"\[\[(.+?)\]\]"; // match: [[ any chars ]] Func<string, string> nameToDocPath = name => name.Replace(" ", "-").ToLower(); const string internalLinkTemplate = @"<a class='internal' href='{0}'>{1}</a>"; Func<Match, string> interalLinkResolver = match => { // match.Value = [[text|doc_name]] or [[doc_name]] var value = match.Value.Substring(2, match.Value.Length - 4); var text = (value.Contains("|")) ? value.Substring(0, value.IndexOf("|", StringComparison.Ordinal)) : value; var name = (value.Contains("|")) ? value.Substring(value.IndexOf("|", StringComparison.Ordinal) + 1) : value; var docPath = nameToDocPath(name); var root = doc.Root; var href = urlHelper.Action("View", "Documents", new { root.Product, root.Language, root.Version, url = docPath }); return string.Format(internalLinkTemplate, href, text); }; return Regex.Replace(html, internalLinkPattern, match => interalLinkResolver(match)); }
static void TestMarkdownSharp() { var result = new Result { Name = "MarkdownSharp" }; var stopwatch = Stopwatch.StartNew(); var warmup = new MarkdownSharp.Markdown(); warmup.Transform(testTexts.First()); stopwatch.Stop(); result.WarmUp = stopwatch.ElapsedMilliseconds; stopwatch = Stopwatch.StartNew(); var markdownify = new MarkdownSharp.Markdown(); stopwatch.Stop(); result.Construction = stopwatch.ElapsedMilliseconds; stopwatch = Stopwatch.StartNew(); markdownify.Transform(testTexts.First()); stopwatch.Stop(); result.FirstRun = stopwatch.ElapsedMilliseconds; stopwatch = Stopwatch.StartNew(); foreach (var text in testTexts) { markdownify.Transform(text); } stopwatch.Stop(); result.BulkRun = stopwatch.ElapsedMilliseconds; result.Average = GetAverage(stopwatch.ElapsedMilliseconds); results.Add(result); }
public Response RenderView(ViewLocationResult viewLocationResult, dynamic model, IRenderContext renderContext) { var response = new HtmlResponse(); var html = renderContext.ViewCache.GetOrAdd(viewLocationResult, result => { string markDown = viewLocationResult.Contents() .ReadToEnd(); var parser = new Markdown(); return parser.Transform(markDown); }); var serverHtml = ParagraphSubstitution.Replace(html, "$1"); var renderHtml = this.engineWrapper.Render(serverHtml, model, new MarkdownViewEngineHost(new NancyViewEngineHost(renderContext), renderContext)); response.Contents = stream => { var writer = new StreamWriter(stream); writer.Write(renderHtml); writer.Flush(); }; return response; }
public static void Main(string[] args) { Markdown md = new Markdown (); var markup = File.ReadAllText (args[0]); var html = md.Transform (markup); Console.WriteLine (html); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; var markdown = context.Request.QueryString["markdown"]; var processor = new Markdown(); context.Response.Write(processor.Transform(markdown)); }
static HtmlString ProcessContent(string fileContent) { var content = new Markdown().Transform(fileContent); content = CodeHighlightRegex.Replace(content, match => { var highlightOptions = match.Groups["highlightOptions"].Value; var linesToHighlight = highlightOptions.Split(',').Select(int.Parse); var codeLines = match.Groups["code"].Value.Split('\n'); foreach (var lineNumber in linesToHighlight) { var lineIndex = lineNumber - 1; if (lineIndex < 0) throw new ArgumentException(string.Format("Tried to highlight a line with index less than 0. The full code block was:\r\n\r\n{0}", match.Value)); if (lineIndex > codeLines.Count() - 1) throw new ArgumentException(string.Format("Tried to highlight a line with index {0}, which doesn't exist. The full code block was:\r\n\r\n{1}", codeLines.Count(), match.Value)); codeLines[lineIndex] = string.Format("<strong>{0}</strong>", codeLines[lineIndex]); } return string.Join(Environment.NewLine, codeLines); }); var contentIncludesASequenceDiagram = false; content = SequenceDiagramRegex.Replace(content, match => { contentIncludesASequenceDiagram = true; var sequenceContent = match.Groups["sequenceContent"].Value; return string.Format("<div class=\"wsd\">{0}</div>", sequenceContent); }); if (contentIncludesASequenceDiagram) content += "\r\n<script type=\"text/javascript\" src=\"http://www.websequencediagrams.com/service.js\" async></script>"; return new HtmlString(content); }
/// <summary> /// Renders stand alone / master page /// </summary> /// <param name="templateContent">Template content</param> /// <returns>HTML converted to markdown</returns> public static string RenderMasterPage(string templateContent) { var second = templateContent.Substring( templateContent.IndexOf("<!DOCTYPE html>", StringComparison.OrdinalIgnoreCase), templateContent.IndexOf("<body", StringComparison.OrdinalIgnoreCase)); var third = templateContent.Substring(second.Length); var forth = templateContent.Substring(second.Length, third.IndexOf(">", StringComparison.Ordinal) + 1); var header = second + forth; var toConvert = templateContent.Substring(header.Length, (templateContent.IndexOf("</body>", StringComparison.Ordinal) - (templateContent.IndexOf(forth, StringComparison.Ordinal) + forth.Length))); var footer = templateContent.Substring(templateContent.IndexOf("</body>", StringComparison.OrdinalIgnoreCase)); var parser = new Markdown(); var html = parser.Transform(toConvert.Trim()); var serverHtml = ParagraphSubstitution.Replace(html, "$1"); //TODO: The "Replace" is simply for unit testing HTML/MD strings. Probably needs improving return string.Concat(header, serverHtml, footer).Replace("\r\n", "").Replace("\n", "").Replace("\r", ""); }
public UDNParsingResults(string path, ITextSnapshot snapshot, MarkdownPackage package, Markdown markdown, FolderDetails folderDetails) { var log = new OutputPaneLogger(); ParsedSnapshot = snapshot; // Use the Publish Flag combo box to set the markdown details. markdown.PublishFlags.Clear(); // Always include public markdown.PublishFlags.Add(Settings.Default.PublicAvailabilitiesString); foreach (var flagName in package.PublishFlags) { markdown.PublishFlags.Add(flagName); } Errors = new List<ErrorDetail>(); Images = new List<ImageConversion>(); Attachments = new List<AttachmentConversionDetail>(); Document = markdown.ParseDocument(ParsedSnapshot.GetText(), Errors, Images, Attachments, folderDetails); DoxygenHelper.SetTrackedSymbols(Document.TransformationData.FoundDoxygenSymbols); CommonUnrealFunctions.CopyDocumentsImagesAndAttachments( path, log, folderDetails.AbsoluteHTMLPath, folderDetails.Language, folderDetails.CurrentFolderFromMarkdownAsTopLeaf, Images, Attachments); // Create common directories like css includes top level images etc. // Needs to be created everytime the document is generated to allow // changes to these files to show in the preview window without // restarting VS. CommonUnrealFunctions.CreateCommonDirectories( folderDetails.AbsoluteHTMLPath, folderDetails.AbsoluteMarkdownPath, log); }
private SyndicationItem FormatLogEntry(LogEntry entry, string repo) { var markdownParser = new Markdown(true); var item = new SyndicationItem(); item.Id = entry.CommitHash; item.Title = new TextSyndicationContent(entry.Subject); item.Content = SyndicationContent.CreateHtmlContent(markdownParser.Transform(entry.Subject + "\n\n" + entry.Body)); item.LastUpdatedTime = entry.AuthorDate; item.PublishDate = entry.CommitterDate; item.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(Url.Action("ViewCommit", "Browse", new { repo, @object = entry.CommitHash }), UriKind.Relative))); item.Categories.Add(new SyndicationCategory("commit")); if (entry.Parents.Count > 1) { item.Categories.Add(new SyndicationCategory("merge")); } item.Authors.Add(new SyndicationPerson(entry.AuthorEmail, entry.Author, null)); if (entry.Author != entry.Committer || entry.AuthorEmail != entry.CommitterEmail) { item.Contributors.Add(new SyndicationPerson(entry.CommitterEmail, entry.Committer, null)); } return item; }
public ActionResult Preview(string data) { var md = new Markdown(); var html = md.Transform(data); ViewBag.Preview = html; return PartialView(); }
public SiteBuilder(string sourcePath, string outputPath, string defaultTemplate) { _sourcePath = new DirectoryInfo(sourcePath); _outputPath = string.IsNullOrEmpty(outputPath) ? new DirectoryInfo(Path.Combine(sourcePath, Constants.OUTPUT)) : new DirectoryInfo(outputPath); _defaultTemplate = defaultTemplate; _markdown = new Markdown(new MarkdownOptions() { AutoHyperlink = true }); }
private void CreateAndPublish(Post p) { var stream = getStream(); if (stream != null) { var cs = new ContentService(); int postId; IContent post; if (TryGetPostId(p, out postId)) post = cs.GetById(postId); else { var parent = createFolderScructure(p.Date, stream); post = cs.CreateContent(p.Name, parent, PostTypeAlias); } MarkdownSharp.Markdown md = new Markdown(); post.SetValue("bodyText", md.Transform(p.Content)); post.SetValue("postDate", p.Date); if (p.Draft) cs.Save(post); else cs.SaveAndPublish(post); } }
public static void Configure() { var options = new MarkdownOptions { AutoHyperlink = true }; var converter = new Markdown(options); Mapper.CreateMap<Entry, EntryViewModel>() // convert content from markdown to html .ForMember(entry => entry.Content, expression => expression.ResolveUsing(source => converter.Transform(source.Content))) // convert summary from markdown to html .ForMember(entry => entry.Summary, expression => expression.ResolveUsing(source => converter.Transform(source.Summary))); // convert the closed type of the derived generic list Mapper.CreateMap<PagedList<Entry>, PagedList<EntryViewModel>>() .AfterMap((entity, model) => Mapper.Map<List<Entry>, List<EntryViewModel>>(entity, model)); Mapper.CreateMap<EntryInput, Entry>() .ForMember(entry => entry.Slug, expression => expression.MapFrom( entry => SlugConverter.Convert(entry.Header))) .ForMember(entry => entry.Tags, expression => expression.MapFrom( entry => TagsResolver.ResolveTags(entry.Tags))); Mapper.CreateMap<Entry, EntryInput>() .ForMember(entry => entry.Tags, opt => opt.MapFrom( entry => TagsResolver.ResolveTags(entry.Tags))); Mapper.CreateMap<Entry, EntryInput>(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SystemInit(); var markdown = new MarkdownSharp.Markdown(); Bmdxx bmd = Bmdxx.FindOne(Condition.Empty); if (bmd != null) { var html = markdown.Transform(bmd.Wiki1); this.ed_Wiki1.Text = html; html = markdown.Transform(bmd.Wiki2); this.ed_Wiki2.Text = html; } } if (!Request.IsAuthenticated) { Response.Redirect("~/Account/Login.aspx"); } //if (Request.IsAuthenticated && !User.IsInRole("Administrators")) //{ // if (User.IsInRole("Students")) // { // Response.Redirect("frmStudent.aspx"); // } // else if (User.IsInRole("Teachers")) // { // Response.Redirect("InputIndex.aspx"); // } //} if (Request.IsAuthenticated) { this.Login1.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { // RegisterHyperLink.NavigateUrl = "Register.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]); if (Request.IsAuthenticated) { if (User.IsInRole("Students")) { // Response.Redirect("frmStudent.aspx"); Response.Redirect("~/frmZhiyuanEdit.aspx"); } } if (!IsPostBack) { var markdown = new MarkdownSharp.Markdown(); Bmdxx bmd = Bmdxx.FindOne(Condition.Empty); if (bmd != null) { var html = markdown.Transform(bmd.Wiki1); this.ed_Wiki1.Text = html; } } }
public static string Summary(string content, int characters) { var md = new MarkdownSharp.Markdown(); return(md.Transform(GetUnTransformedSummary(content, characters))); }
static ConvertFileResponse ConvertFile(MarkdownSharp.Markdown markdownToHtml, string inputFileName, string language, IEnumerable<string> languagesLinksToGenerate, OutputFormat format = OutputFormat.HTML) { var result = ConvertFileResponse.NoChange; var targetFileName = GetTargetFileName(inputFileName, language); //Set up parameters in Markdown to aid in processing and generating html Markdown.MetadataErrorIfMissing = MetadataErrorIfMissing; Markdown.MetadataInfoIfMissing = MetadataInfoIfMissing; markdownToHtml.DoNotPublishAvailabilityFlag = Settings.Default.DoNotPublishAvailabilityFlag; markdownToHtml.PublishFlags = PublishFlags.ToList(); markdownToHtml.AllSupportedAvailability = AllSupportedAvailability; var fileOutputDirectory = FileHelper.GetRelativePath( SourceDirectory, Path.GetDirectoryName(inputFileName)); var currentFolderDetails = new FolderDetails( GetRelativeHTMLPath(targetFileName), OutputDirectory, SourceDirectory, fileOutputDirectory, Settings.Default.APIFolderLocation, (new DirectoryInfo(inputFileName).Parent).FullName.Replace( SourceDirectory + Path.DirectorySeparatorChar.ToString(), "") .Replace(SourceDirectory, "") .Replace(Path.DirectorySeparatorChar.ToString(), " - "), language); markdownToHtml.DefaultTemplate = DefaultTemplate; markdownToHtml.ThisIsPreview = ThisIsPreview; if (language != "INT") { currentFolderDetails.DocumentTitle += " - " + language; } if (ThisIsPreview) { currentFolderDetails.DocumentTitle += " - PREVIEW!"; } markdownToHtml.SupportedLanguages = SupportedLanguages; //Pass the default conversion settings to Markdown for use in the image details creation. markdownToHtml.DefaultImageDoCompress = DoCompressImages; markdownToHtml.DefaultImageFormatExtension = CompressImageType; markdownToHtml.DefaultImageFillColor = DefaultImageFillColor; markdownToHtml.DefaultImageFormat = CompressImageFormat; markdownToHtml.DefaultImageQuality = JpegCompressionRate; var errorList = new List<ErrorDetail>(); var imageDetails = new List<ImageConversion>(); var attachNames = new List<AttachmentConversionDetail>(); var output = markdownToHtml.Transform(FileContents(inputFileName), errorList, imageDetails, attachNames, currentFolderDetails, languagesLinksToGenerate, format != OutputFormat.HTML); var noFailedErrorReport = true; var stopProcessing = false; //If output empty then treat as failed, we are not converting most likely due to the publish flags and availability settings if (String.IsNullOrWhiteSpace(output)) { noFailedErrorReport = false; stopProcessing = true; result = ConvertFileResponse.NoChange; log.Info(MarkdownSharp.Language.Message("NotConverted", inputFileName)); } else { //Need to check for error types prior to processing to output log messages in the correct order. foreach (var errorInfo in errorList) { if (errorInfo.ClassOfMessage == MessageClass.Error || errorInfo.ClassOfMessage == MessageClass.Warning) { log.Info(MarkdownSharp.Language.Message("FileFailed", inputFileName)); noFailedErrorReport = false; break; } } } if (noFailedErrorReport) { log.Info(MarkdownSharp.Language.Message("Converted", inputFileName)); } //On warnings or errors stop processing the file to the publish folder but allow to continue if in preview. if (errorList.Count > 0) { Console.Write("\n"); foreach (MarkdownSharp.ErrorDetail ErrorInfo in errorList) { switch (ErrorInfo.ClassOfMessage) { case MarkdownSharp.MessageClass.Error: log.Error(ErrorInfo.Path ?? inputFileName, ErrorInfo.Line, ErrorInfo.Column, ErrorInfo.Message); if (!ThisIsPreview) { stopProcessing = true; result = ConvertFileResponse.Failed; } break; case MarkdownSharp.MessageClass.Warning: log.Warn(ErrorInfo.Path ?? inputFileName, ErrorInfo.Line, ErrorInfo.Column, ErrorInfo.Message); if (!ThisIsPreview) { stopProcessing = true; result = ConvertFileResponse.Failed; } break; default: log.Info(ErrorInfo.Path ?? inputFileName, ErrorInfo.Line, ErrorInfo.Column, ErrorInfo.Message); break; } } } if (!stopProcessing) { if (ThisIsPreview || !ThisIsLogOnly) { CommonUnrealFunctions.CopyDocumentsImagesAndAttachments(inputFileName, log, OutputDirectory, language, fileOutputDirectory, imageDetails, attachNames); } var expected = FileContents(targetFileName); if (output == expected) { result = ConvertFileResponse.NoChange; } else { if (!stopProcessing) { if (!AlreadyCreatedCommonDirectories) { AlreadyCreatedCommonDirectories = CommonUnrealFunctions.CreateCommonDirectories(OutputDirectory, SourceDirectory, log); } Console.Write("\n"); if (ThisIsPreview || !ThisIsLogOnly) { //Check output directory exists, if not create the full html structure for this language CommonUnrealFunctions.GenerateDocsFolderStructure(OutputDirectory, fileOutputDirectory, language); CommonUnrealFunctions.SetFileAttributeForReplace(new FileInfo(targetFileName)); File.WriteAllText(targetFileName, output); if (format == OutputFormat.PDF) { PdfHelper.CreatePdfFromHtml(targetFileName); } } result = ConvertFileResponse.Converted; } } } return result; }