Пример #1
0
 public IHtmlFile Convert(IMarkdownFile markdownFile)
 {
     // Console.WriteLine("Starting conversion of files");
     // Console.WriteLine($"(1) Starting conversion of file {file.Name}");
     return(new HtmlFile
     {
         HtmlContent = Convert(markdownFile.Elements),
         Name = Path.Combine(Options.OutputLocation ?? String.Empty,
                             Path.GetFileName(markdownFile.Name))
     });
     // Console.WriteLine($"(1) Done converting file {file.Name}");
 }
Пример #2
0
        private async Task <string> GetHtmlContentAsync(string path, string fileName)
        {
            IMarkdownFile contentFile = (await _sourceProvider.GetAsync(path, WriteLog)).FindFile(fileName) as IMarkdownFile;

            if (contentFile == null)
            {
                return(null);
            }

            ITemplateFile cloneContentFile = (await _cloneProvider.GetAsync(path, WriteLog)).FindFile(fileName);

            // Get the markdown
            using (var httpClient = new HttpClient())
            {
                // Get html
                string html = await contentFile.GetHtmlAsync();

                // Change relative uris
                return(ChangeUris(cloneContentFile.DownloadUri, html));
            }
        }
Пример #3
0
        private async Task <string> GetDescriptionAsync(string path)
        {
            IMarkdownFile readmeFile = (await _sourceProvider.GetAsync(path, WriteLog)).FindFile(README_NAME) as IMarkdownFile;

            if (readmeFile == null)
            {
                return(null);
            }

            ITemplateFile cloneReadmeFile = (await _cloneProvider.GetAsync(path, WriteLog)).FindFile(README_NAME);

            // Get the markdown
            using (var httpClient = new HttpClient())
            {
                // Get html
                string html = await readmeFile.GetHtmlAsync();

                // Change relative uris
                return(ChangeUris(cloneReadmeFile.DownloadUri, html));
            }
        }