diff --git a/src/convert.rs b/src/convert.rs index e3ce4b1..7b99491 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -43,6 +43,26 @@ pub fn convert_document(markdown: &str) -> String { continue; } + if let Some(img_info) = line.strip_prefix("==image:") { + let (src, alt) = img_info.split_once(':').unwrap(); + html += &format!("{alt}\n"); + continue; + } + + if let Some(video_info) = line.strip_prefix("==video:") { + let mut attributes = video_info.split(':'); + let src = attributes.next().unwrap(); + let alt = attributes.next().unwrap_or_else(|| &"\"\""); + let extra = attributes.next().unwrap_or_default(); + html += &format!("\n"); + continue; + } + + if let Some(youtube_id) = line.strip_prefix("==youtube:") { + html += &format!("https://youtu.be/{youtube_id}"); + continue; + } + if let Some((start, header)) = line.split_once(' ') { let level = start.len(); if (1..=6).contains(&level) && start.chars().all(|c| c == '#') {