pub async fn async_generate_html(markdown: &str) -> Result<String>Expand description
Asynchronously generates HTML from Markdown content.
Processes Markdown in a separate thread to avoid blocking the async runtime, optimized for efficient memory usage with larger content.
§Arguments
markdown- Markdown content to convert to HTML
§Returns
Returns the generated HTML content if successful.
§Errors
Returns HtmlError if:
- Thread spawning fails
- Markdown processing fails
§Examples
ⓘ
use html_generator::performance::async_generate_html;
#[tokio::main]
async fn main() -> Result<(), html_generator::error::HtmlError> {
let markdown = "# Hello\n\nThis is a test.";
let html = async_generate_html(markdown).await?;
println!("Generated HTML length: {}", html.len());
Ok(())
}