Sample code for 30+ languages & platforms
Rust Requires Chilkat v11.2.0+

Markdown to HTML - Full Document, Raw

See more Markdown Examples

Demonstrates how to convert a complete Markdown document to HTML using the raw theme. With the raw theme, only the HTML elements are generated, excluding:

  • 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

Rust

let options = chilkat::JsonObject::new();
let _ = options.update_string("theme", "raw");

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());

// Sample markdown input:
// (See sample HTML output below.)

// image

// Sample HTML output:

// image