public async Task <IViewComponentResult> InvokeAsync(GitHubRendererArgs arg)
        {
            var markdownUrl = $"https://raw.githubusercontent.com/{arg.Org}/{arg.Repo}/master/README.md";
            var markdown    = await _http.Get(new AiurUrl(markdownUrl), false);

            var pipeline = new MarkdownPipelineBuilder()
                           .UseAdvancedExtensions()
                           .Build();
            var html  = Markdown.ToHtml(markdown, pipeline);
            var model = new GitHubRendererViewModel
            {
                Org  = arg.Org,
                Repo = arg.Repo,
                HTML = html
            };

            return(View(model));
        }
Beispiel #2
0
        public async Task <IViewComponentResult> InvokeAsync(string org, string repo)
        {
            var markdownUrl = $"https://raw.githubusercontent.com/{org}/{repo}/master/README.md";
            var markdown    = await _cache.GetAndCache($"github.{org}.{repo}.cache",
                                                       async() => await _http.Get(new AiurUrl(markdownUrl), false));

            var pipeline = new MarkdownPipelineBuilder()
                           .UseAdvancedExtensions()
                           .Build();
            var html  = Markdown.ToHtml(markdown, pipeline);
            var model = new GitHubRendererViewModel
            {
                Org  = org,
                Repo = repo,
                HTML = html
            };

            return(View(model));
        }