Monday, November 24, 2014

[C#] How to render GitHub-flavored markdown with GitHub API

The following code can be used to generate HTML from GitHub-flavored markdown using GitHub API:

static public String RenderGithubMarkdow(String markdown)
{
    var webClient = new WebClient();
    webClient.Headers.Add("User-Agent", "ghmd-renderer");
    webClient.Headers.Add("Content-Type", "text/x-markdown");
    return webClient.UploadString("https://api.github.com/markdown/raw", "POST", markdown);
}

Related posts:
  • The minimal amount of CSS to replicate the GitHub Markdown style
  • How to render GitHub-flavored markdown offline
  • No comments:

    Post a Comment