feat: added caption for video BlockType

chore: updated to newer version of notion-client
This commit is contained in:
Bram Dingelstad 2025-03-15 22:16:53 +01:00
parent 03c3b887b1
commit 6b2c2cc60b

View file

@ -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,