Пример #1
0
        public async Task OnGet()
        {
            var readmePath = System.IO.Path.Combine(_webHostEnvironment.GetWebRootPath(), README_FILE);

            if (!System.IO.File.Exists(readmePath))
            {
                readmePath = System.IO.Path.Combine(_webHostEnvironment.ContentRootPath, "..", README_FILE);
            }

            using (var httpClient = new HttpClient())
            {
                //var readMeMarkdown = System.IO.File.ReadAllText(readmePath);
                var readMeMarkdown = await httpClient.GetStringAsync("https://raw.githubusercontent.com/fschick/LaterList/master/README.md");

                var pipeline = new MarkdownPipelineBuilder().UseSoftlineBreakAsHardlineBreak().Build();
                ReadmeMarkup = Markdown
                               .ToHtml(readMeMarkdown, pipeline)
                               .Replace("https://laterlist.de", $"{Request.Scheme}://{Request.Host}")
                               .Replace("<a href=", "<a target=\"_blank\" href=");
            }

            ProductName    = _informationService.GetProductName();
            ProductVersion = _informationService.GetProductVersion();
            Copyright      = _informationService.GetCopyright();
        }