Table of Contents

Method HtmlToMarkdown

Namespace
LMKit.Document.Conversion
Assembly
LM-Kit.NET.dll

HtmlToMarkdown(string, MarkdownHtmlConversionOptions)

Converts HTML to Markdown.

public static string HtmlToMarkdown(string html, MarkdownHtmlConversionOptions options = null)

Parameters

html string

The HTML content to convert.

options MarkdownHtmlConversionOptions

Optional conversion options to customize the output.

Returns

string

The converted Markdown string.

Examples

using LMKit.Document.Conversion;

string html = "<h1>Title</h1><p>Hello <strong>world</strong>.</p>";
string markdown = MarkdownHtmlConverter.HtmlToMarkdown(html);

// markdown is similar to:
// # Title
//
// Hello **world**.

Exceptions

ArgumentNullException

Thrown when html is null.

HtmlToMarkdown(string)

Converts HTML text to Markdown using default conversion options.

public static string HtmlToMarkdown(string html)

Parameters

html string

Returns

string

Examples

using LMKit.Document.Conversion;

string markdown = MarkdownHtmlConverter.HtmlToMarkdown("<p><strong>Hello</strong> from HTML</p>");
Console.WriteLine(markdown);