pub fn generate_html_with_diagnostics(
markdown: &str,
config: &HtmlConfig,
) -> Result<HtmlOutput>Expand description
Like generate_html, but returns an HtmlOutput that includes
diagnostics for any post-processing steps that failed non-fatally.
§Examples
use html_generator::{
generator::{generate_html_with_diagnostics, DiagnosticLevel},
HtmlConfig,
};
let out =
generate_html_with_diagnostics("# Hello", &HtmlConfig::default()).unwrap();
assert!(out.html.contains("<h1>"));
// No fatal errors; any diagnostics are informational or warnings.
assert!(
out.diagnostics
.iter()
.all(|d| d.level != DiagnosticLevel::Error)
);§Errors
Returns crate::error::HtmlError if the core Markdown→HTML
conversion fails. Non-fatal post-processing failures are recorded
as Error-level diagnostics rather than propagated.