Home
Options

Helpful Hint: Rendering Markdown in LINQPad Dumps

I'm posting this here for anyone interested in doing this. I've been playing around with LLMs and LangChain to modify or document code, and often I get responses in MarkDown. I ran across some code on GitHub that renders markdown within a markdown tag in HTML.

LINQPad's Util.RawHtml() utility function can load this script and dump out text to be rendered as HTML. With minimal effort, this can be added to your custom extensions to create a method for dumping markdown text.

Example:

    string markdown = "# Header\r\n- Bullet 1\r\n- Bullet 2\r\n- ~~Stricken Bullet 3~~";

    Util.RawHtml($"<script src=\"https://cdn.jsdelivr.net/gh/MarketingPipeline/Markdown-Tag/markdown-tag.js\"></script><md>{markdown}</md>").Dump();

Enjoy!

Sign In or Register to comment.