// src/examples/utils_example.rs #![allow(missing_docs)] use html_generator::utils::{ extract_front_matter, format_header_with_id_class, generate_table_of_contents, }; use html_generator::HtmlError; fn main() -> Result<(), HtmlError> { println!("\n๐งช html-generator Utils Examples\n"); extract_front_matter_example()?; format_header_with_id_class_example()?; generate_table_of_contents_example()?; println!("\n๐ All utils examples completed successfully!"); Ok(()) } /// Demonstrates extracting front matter from Markdown content. fn extract_front_matter_example() -> Result<(), HtmlError> { println!("๐ฆ Extract Front Matter Example"); println!("---------------------------------------------"); let content = "---\ntitle: My Page\n---\n# Hello, world!\n\nThis is a test."; match extract_front_matter(content) { Ok(remaining_content) => { println!("Remaining Content: \n{}", remaining_content); } Err(e) => { println!("Failed to extract front matter: {}", e); } } Ok(()) } /// Demonstrates formatting a header with an ID and class. fn format_header_with_id_class_example() -> Result<(), HtmlError> { println!("\n๐ฆ Format Header with ID and Class Example"); println!("---------------------------------------------"); let header = "
Some content
More content