示例#1
0
        // TODO: remove this function as it breaks incremental build's design.
        public string Markup(string markdown, string sourceFileKey)
        {
            if (string.IsNullOrEmpty(sourceFileKey) || string.IsNullOrEmpty(markdown))
            {
                return(markdown);
            }
            if (_context.MarkdownService == null)
            {
                var message = $"Markup failed: {nameof(_context.MarkdownService)} should not be null";
                Logger.LogError(message);
                throw new DocfxException(message);
            }
            MarkupResult mr;

            try
            {
                mr = _context.MarkdownService.Markup(markdown, sourceFileKey);
                mr = MarkupUtility.Parse(mr, sourceFileKey, _context.AllSourceFiles);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Fail("Markup failed!");
                var message = $"Markup failed: {ex.Message}.";
                throw new DocumentException(message, ex);
            }
            return(mr.Html);
        }
示例#2
0
 public MarkupResult Parse(MarkupResult markupResult, FileAndType ft)
 {
     return(MarkupUtility.Parse(markupResult, ft.File, SourceFiles));
 }