html_generator::generator

Function generate_html

source
pub fn generate_html(markdown: &str, _config: &HtmlConfig) -> Result<String>
Expand description

Generate HTML from Markdown content using mdx-gen.

This function takes Markdown content and a configuration object, converts the Markdown into HTML, and returns the resulting HTML string.

§Arguments

  • markdown - A string slice that holds the Markdown content to convert.
  • _config - A reference to an HtmlConfig struct that holds the configuration options.

§Returns

  • Result<String> - The generated HTML or an error if the conversion fails.

§Example

use html_generator::HtmlConfig;
use html_generator::generate_html;
let markdown = "# Hello, world!";
let config = HtmlConfig::default();
let html = generate_html(markdown, &config).unwrap();
assert!(html.contains("<h1>Hello, world!</h1>"));