diff --git a/src/lib.rs b/src/lib.rs index 11ec212..a3e76a5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -168,9 +168,29 @@ pub async fn convert_blocks( } BlockType::Video { video, .. } => { match &video { - notion::File::External { external, .. } => { + notion::File::External { + external, caption, .. + } => { let url = &external.url; - Some(format!(r#"<video controls src="{url}" />"#)) + + let caption = if let Some(caption) = caption { + format!( + "<figcaption>{text}</figcaption>", + text = &caption + .iter() + .map(|rich_text| rich_text.plain_text()) + .collect::<String>() + ) + } else { + "".to_string() + }; + + Some(format!( + r#"<figure> + <video controls src="{url}"></video> + {caption} + </figure>"# + )) } // TODO: Implement reupload of Notion file type _ => None, @@ -184,7 +204,7 @@ pub async fn convert_blocks( BlockType::ColumnList { .. } => { if block.has_children { let columns = notion - .blocks + .blocks() .children() .list(notion::BlockChildrenListOptions { block_id: &block.id, @@ -196,7 +216,7 @@ pub async fn convert_blocks( let mut content = vec![]; for column in columns.iter() { let children = notion - .blocks + .blocks() .children() .list(notion::BlockChildrenListOptions { block_id: &column.id,