pub fn markdown_to_html(
content: &str,
config: Option<MarkdownConfig>,
) -> Result<String>
Expand description
Converts Markdown content to HTML.
This function processes Unicode Markdown content and returns HTML output. The input must be valid Unicode - if your input is encoded (e.g., UTF-8), you must decode it before passing it to this function.
§Arguments
content
- The Markdown content as a Unicode stringconfig
- Optional configuration for the conversion
§Returns
Returns the generated HTML as a Unicode string wrapped in a Result
§Errors
Returns an error if:
- The input content is invalid Unicode
- HTML generation fails
- Input size exceeds configured maximum
§Examples
use html_generator::{markdown_to_html, MarkdownConfig};
let markdown = "# Hello\n\nWorld";
let html = markdown_to_html(markdown, None)?;
assert!(html.contains("<h1>Hello</h1>"));