Why I Built a C# Markdown to/from HTML, and AmigaGuide to HTML Converter

Description: “A lightweight, safe and complete .md to .html, .html to .md, .txt to .html, .html to .txt, and .guide to .html converter built in C#, and why existing tools like Pandoc and Typora didn’t meet my needs.”

🚀 Introducing the Markdown to HTML Converter You Didn’t Think Was Possible

“If you’d told me a year ago that it’s possible to build a faster and fully standards-compliant Markdown-to-HTML converter than Pandoc—in a single C# file, with built-in XSS protection, working on both .NET Framework and .NET 7/8/9—I honestly wouldn’t have believed it myself. So I built it to prove it can be done.”

I’ve always admired tools like Pandoc for their power. But I wanted:

In my personal and professional work, I needed a reliable Markdown to HTML converter that could:

After trying several popular tools — Pandoc, Typora, VS Code Markdown preview — I ran into limitations I couldn’t accept.

🔍 Why Not Use Pandoc or Typora?

These tools are powerful. But they weren’t right for my needs:

Tool Limitations
Pandoc Heavy binary, slow execution, poor table rendering, no task lists
Typora Lacks XSS protection, doesn’t support multi-line footnotes, inconsistent HTML
VS Code Basic preview only, no customization

When you care about structure, safety, and full feature coverage, even powerful tools fall short.

As someone who needed a fast, embeddable Markdown to / from HTML converter in C#, I couldn’t find anything that met all of these goals:

✅ Small and dependency-free
✅ Fully supports advanced Markdown (TOC, footnotes, tables, tasks…)
✅ XSS-safe and robust for user input
✅ Easy to integrate into console, desktop, or web apps

So I built it.


Markdown to HTML Converter

✅ Markdown Supported Features

✅ The generated HTML code is valid according to W3C standards, verified through the W3C Validator.

🔐 Security Considerations

This converter includes built-in logic to detect and sanitize potentially dangerous HTML input:

No external libraries or HTML sanitizers are required — the security logic is fully self-contained.

🚨 Warnings for Syntax and Security Issues

It’s ideal for batch-processing Markdown or handling user-submitted content.


HTML to Markdown Converter

✅ HTML Supported Features

🚨 Warnings for HTML Syntax and Security Issues


AmigaGuide to HTML Converter

✅ AmigaGuide Supported Features

✅ The generated HTML code is valid according to W3C standards, verified through the W3C Validator.


Smart Plain Text to HTML Converter

✅ Plain Text Supported Features


HTML to Plain Text Converter


Other Derived Conversions


⚡ One C# File. One Line to Use It

Instead of building a framework, I created a single-file class you can just drop into your project and use like this:

string html = ConvMarkdownHtml.Convert(markdown);
string markdown = ConvHtmlMarkdown.Convert(html);
string html = ConvGuideHtml.Convert(amigaGuide);
string html = ConvHtmlMarkdown.SmartTxtConvert(txt);
string txt = ConvHtmlMarkdown.ConvertToTxt(html);

Done. No NuGet packages. No third-party libs. No surprises.


🌟 Additional Benefits


🧠 Design Philosophy

One C# file. One method.


📦 Try It or Fork It

🔹 Just want to test it? Download the mdoc.exe and run:

mdoc input.md output.html
mdoc input.md output.txt
mdoc input.html output.md
mdoc input.html output.txt
mdoc input.txt output.html
mdoc input.txt output.md
mdoc input.guide output.html
mdoc input.guide output.md
mdoc input.guide output.txt

🔹 Want to embed or extend it? Just copy the .cs file into your project and you’re done.

👉 GitHub: milos-p-lab/MarkdownGuideHtmlConverter


If you’re tired of bloated or unsafe Markdown tools — try this minimalist approach. I built it for me, but maybe it’s exactly what you need too.


Made with focus and precision by Miloš Perunović 😊