#[cfg(test)] mod tests { use comrak::ComrakOptions; use mdx_gen::{process_markdown, MarkdownOptions}; #[test] fn test_markdown_options_default() { let options = MarkdownOptions::default(); assert!(options.enable_custom_blocks); assert!(options.enable_syntax_highlighting); assert!(options.enable_enhanced_tables); } #[test] fn test_markdown_options_customization() { let options = MarkdownOptions::new() .with_custom_blocks(false) .with_syntax_highlighting(false) .with_enhanced_tables(false); assert!(!options.enable_custom_blocks); assert!(!options.enable_syntax_highlighting); assert!(!options.enable_enhanced_tables); } #[test] fn test_process_markdown_with_default_options() { let markdown = "# Heading\n\nThis is a **bold** text."; let options = MarkdownOptions::new().with_comrak_options({ let mut opts = ComrakOptions::default(); opts.extension.table = true; // Enable table extension opts }); let result = process_markdown(markdown, &options) .expect("Failed to process markdown"); assert!(result.contains("
Cell 1 | "), "Cell 1 was not processed correctly" ); assert!( result.contains("Cell 2 | "), "Cell 2 was not processed correctly" ); } #[test] fn test_process_markdown_with_syntax_highlighting() { let markdown = "```rust\nfn main() {\n println!(\"Hello, world!\");\n}\n```"; let options = MarkdownOptions::new() .with_syntax_highlighting(true) .with_comrak_options({ let mut opts = ComrakOptions::default(); opts.extension.table = true; // Ensure the table extension is enabled to avoid conflicts opts }); let result = process_markdown(markdown, &options).expect( "Failed to process markdown with syntax highlighting", ); println!( "Processed Markdown (Syntax Highlighting):\n{}", result ); // Check that the syntax highlighting and code block are processed assert!(result.contains("