Rust Requires Chilkat v11.2.0+
Rust
Markdown to HTML - Full Document, Default
See more Markdown Examples
Demonstrates how to convert a complete Markdown document to HTML using no specified theme. This is the default when the JSON options is empty. Unlike theraw theme, the default produces a full HTML document including:
- Document Type Declaration (e.g. <!DOCTYPE html>)
- Root Element (e.g., <html> )
- Head Section
- Enclosing <body> and </body> elements
- Closing </html> element
Chilkat Rust Downloads
// Leaving the options empty produces a full HTML document.
let options = chilkat::JsonObject::new();
let sb_markdown = chilkat::StringBuilder::new();
let sb_html = chilkat::StringBuilder::new();
if sb_markdown.load_file("qa_data/markdown/test1.md", "utf-8").is_err() {
println!("{}", sb_markdown.last_error_text());
return;
}
let _ = sb_markdown.markdown_to_html(&options, &sb_html);
let _ = sb_html.to_crlf();
println!("{}", sb_html.get_as_string().unwrap_or_default());
// The sample markdown input for this example is identical to the one at Markdown to HTML - Full Document, Raw, where you can view it.
// Sample HTML output as viewed in a browser:
//