pub fn extract_header_id(line: &str) -> (String, Option<String>)Expand description
Extract custom header ID from a line if present, returning clean text and ID
Supports multiple formats:
- Kramdown:
{#id} - Python-markdown:
{:#id},{: #id},{: #id .class}
ยงExamples
use rumdl_lib::utils::header_id_utils::extract_header_id;
// Kramdown format
let (text, id) = extract_header_id("# Header {#custom-id}");
assert_eq!(text, "# Header");
assert_eq!(id, Some("custom-id".to_string()));
// Python-markdown attr-list format
let (text, id) = extract_header_id("# Header {: #my-id .highlight}");
assert_eq!(text, "# Header");
assert_eq!(id, Some("my-id".to_string()));