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
htmlstringThe HTML content to convert.
optionsMarkdownHtmlConversionOptionsOptional 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
htmlisnull.
HtmlToMarkdown(string)
Converts HTML text to Markdown using default conversion options.
public static string HtmlToMarkdown(string html)
Parameters
htmlstring
Returns
Examples
using LMKit.Document.Conversion;
string markdown = MarkdownHtmlConverter.HtmlToMarkdown("<p><strong>Hello</strong> from HTML</p>");
Console.WriteLine(markdown);