Caption property is now supported for code block type
almost 3 years ago by MJ Felix
We have added support for adding, updating, and retrieving the caption
property for code
block types.
Below is an example response from append block children containing a code block, with a caption, uploaded to Notion.
{
"object": "list",
"results": [
{
"object": "block",
"id": "block-id",
"created_time": "2021-10-14T18:10:00.000Z",
"last_edited_time": "2021-10-14T18:10:00.000Z",
"has_children": false,
"archived": false,
"type": "code",
"code": {
"caption": [
{
"type": "text",
"text": {
"content": "Hello Caption!",
"link": null
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "Hello Caption!",
"href": null
}
],
"text": [
{
"type": "text",
"text": {
"content": "const foo = \"bar\"",
"link": null
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "const foo = \"bar\"",
"href": null
}
],
"language": "javascript"
}
},
],
"next_cursor": null,
"has_more": false
}