Introduction

edit

Meziantou.Framework.HtmlToMarkdown converts HTML to Markdown: headings, paragraphs, emphasis, links, images, lists, task lists, block quotes, code, tables and definition lists. Use it to import web pages or rich text into a Markdown documentation, a wiki or a chat message. Meziantou.Framework.HtmlToMarkdown.Tool does the same from the command line.

What you can do with it

How it works

HtmlToMarkdown.Convert parses the HTML with the HTML parser of Meziantou.Framework.WebPlatform, as a browser does: invalid markup, missing end tags and entities are handled the same way. It then walks the tree and writes the Markdown of each element. The text is escaped, so that a * or a # of the HTML stays a character and does not start Markdown syntax.

The output follows CommonMark, and uses the common extensions for what CommonMark does not have: pipe tables, task lists, strikethrough and definition lists.

HtmlToMarkdown and its options are in the Meziantou.Framework namespace.

Next steps