Privacy and cookie policy

Html rendering of a GitHub MD file

This sample shows how to retrieve a MD file from GitHub, render it locally to HTML using Markdig library and show it as a web page. Images are retrieved on-the-fly from GitHub, through the web-application that works as proxy. <img> src is updateed using HtmlAgilityPack.
The project is an Asp.Net (.NET Framework) web application. The logic can be easily adapted to Asp.Net Core (...todo).

[browser]  ---->  [web-app] ----> [github]
  • simple.aspx : gets the content from GitHub and renders it to html. MD and images are retrieved from GitHub on every request.
  • full.aspx : full solution with local caching of html and images and use of PrismJS for syntax highlighting of code blocks.


Output example


Original document:
DISCLAIMER: Content and opinions are my own. None of the ideas expressed in this web-site are shared, supported, or endorsed in any manner by my current or former employers. Nothing here should be taken seriously and you understand and accept that you can use any suggestions, ideas, techincal solutions on this web-site only at your own risk. All trademarks are property of their respective owners.