use std::{fs, path::Path}; use comrak::{markdown_to_html, Options}; fn main() { let manifest = Path::new(env!("CARGO_MANIFEST_DIR")); let fixtures = [ ("examples/good/branches.mq.md", "examples/rendered/branches.html"), ("examples/bad/branch-single-item.mq.md", "examples/rendered/branch-single-item.html"), ("examples/nested/inventory.mq.md", "examples/rendered/inventory.html"), ("examples/knowledge/discount.mq.md", "examples/rendered/discount.html"), ]; let mut options = Options::default(); options.extension.table = true; options.extension.strikethrough = true; options.extension.tasklist = true; options.extension.math_dollars = true; options.extension.math_dollars_block = true; options.extension.front_matter_delimiter = Some("---".to_string()); for (source, target) in fixtures { let source_path = manifest.join(source); let markdown = fs::read_to_string(&source_path).expect("读取渲染 Fixture"); let body = markdown_to_html(&markdown, &options); let html = format!("\n\n\n