private async Task AddShowNotes(Models.Podcast podcast) { try { var response = await _httpClient.GetAsync($"https://content.red-folder.com/podcasts/{podcast.SafeUrl}.md"); if (!response.IsSuccessStatusCode) { if (response.StatusCode == System.Net.HttpStatusCode.NotFound) { // Fall back to the number notation i.e. 4.md response = await _httpClient.GetAsync($"https://content.red-folder.com/podcasts/{podcast.EpisodeNumber}.md"); if (!response.IsSuccessStatusCode) { return; } } } var markdown = await response.Content.ReadAsStringAsync(); HeyRed.MarkdownSharp.Markdown processor = new HeyRed.MarkdownSharp.Markdown(); podcast.ShowNotes = processor.Transform(markdown); } catch { } }
public static string ToHtml(string mdText) { var markdown = new HeyRed.MarkdownSharp.Markdown(); string html = markdown.Transform(mdText); return(html); }
public static string Markdown(string text) { var m = new HeyRed.MarkdownSharp.Markdown(); var html = m.Transform(text); return(html); }
public async Task <string> GetMarkdownStringAsync(string key) { var entity = await _microTextStore.LoadAsync(key); if (entity == null || entity.Language != Markdown) { return(null); } var processor = new HeyRed.MarkdownSharp.Markdown(); return(processor.Transform(entity.Text)); }
public override string GetHtml(string markdown) { var engine = new HeyRed.MarkdownSharp.Markdown(_options); return(engine.Transform(markdown)); }
protected override string PostTransform(JObject meta, string markdown) { HeyRed.MarkdownSharp.Markdown processor = new HeyRed.MarkdownSharp.Markdown(); return(processor.Transform(markdown)); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseStaticFiles(); app.UseHumid( env, routes => { var get_hello_A = Get("/a") | Content("Hello A") | OK; var any_hello_B = new Route("/b", OK) | Content("Hello B"); var delete_only_hello_C = Path("/c") | Verbs(DELETE) | Content("Hello C") | OK; var get_hello_name = Get("/hello/{name}") | Do(ctx => ctx.With(content: $"Hello {ctx.Params<string>("name", "world").ToUpper()}")) | OK; var get_hello_object = Get("/hello/world") | Do(ctx => { var md = new HeyRed.MarkdownSharp.Markdown(); var html = md.Transform("<h2>Hello,</h2><p>**uncatched route**</p>"); return(new{ message = html, value = 42 }); }) | OK; var get_hello_view = Get("/niceHello/{name}") | Do(ctx => { int id = ctx.Query <int>("id", -1); var name = ctx.Params <string>("name", "world"); return(new { name, id }); }) | Html("simpleHello") | OK | Log("production"); var get_hello_liquid = Get("/liquid/hello") | Do(c => new { name = new { first = c.Query <string>("name", "world") } }) | Html("liquid/simple") | OK | Log( match: "Production", logger: c => Console.WriteLine($"match : {c.Request.TypeName} {c.Request.Path}")); //how to group routes by functionality, ex: var groupedRoutesWithViews = f <Router>(r => r - get_hello_view - get_hello_liquid); return(routes - get_hello_A - any_hello_B - delete_only_hello_C - get_hello_object - get_hello_name - groupedRoutesWithViews ); }); app.Run(async(context) => { if (context.Response.StatusCode == 400) { await context.Response.WriteAsync("your query doesn't match any route"); } }); }
public DependentOnMarkdownAndHtmlAgilityPackMarkdownTransformer(HeyRed.MarkdownSharp.Markdown markdown, HtmlDocument document) { _markdown = markdown; _document = document; }