@@ -243,17 +243,28 @@ def _(node: nodes.title, *, section_level: int) -> list[NotionObject[Any]]:
243243 return [block ]
244244
245245
246+ def _create_admonition_callout (
247+ node : nodes .Element ,
248+ * ,
249+ emoji : str ,
250+ color : Color ,
251+ ) -> list [NotionObject [Any ]]:
252+ """
253+ Create a Notion Callout block for admonition nodes.
254+ """
255+ rich_text = _create_rich_text_from_children (node = node )
256+ block = UnoCallout (text = "" , icon = Emoji (emoji = emoji ), color = color )
257+ block .rich_text = rich_text
258+ return [block ]
259+
260+
246261@_process_node_to_blocks .register
247262def _ (node : nodes .note , * , section_level : int ) -> list [NotionObject [Any ]]:
248263 """
249264 Process note admonition nodes by creating Notion Callout blocks.
250265 """
251266 del section_level
252- rich_text = _create_rich_text_from_children (node = node )
253-
254- block = UnoCallout (text = "" , icon = Emoji (emoji = "📝" ), color = Color .BLUE )
255- block .rich_text = rich_text
256- return [block ]
267+ return _create_admonition_callout (node = node , emoji = "📝" , color = Color .BLUE )
257268
258269
259270@_process_node_to_blocks .register
@@ -262,11 +273,7 @@ def _(node: nodes.warning, *, section_level: int) -> list[NotionObject[Any]]:
262273 Process warning admonition nodes by creating Notion Callout blocks.
263274 """
264275 del section_level
265- rich_text = _create_rich_text_from_children (node = node )
266-
267- block = UnoCallout (text = "" , icon = Emoji (emoji = "⚠️" ), color = Color .YELLOW )
268- block .rich_text = rich_text
269- return [block ]
276+ return _create_admonition_callout (node = node , emoji = "⚠️" , color = Color .YELLOW )
270277
271278
272279@_process_node_to_blocks .register
@@ -275,11 +282,7 @@ def _(node: nodes.tip, *, section_level: int) -> list[NotionObject[Any]]:
275282 Process tip admonition nodes by creating Notion Callout blocks.
276283 """
277284 del section_level
278- rich_text = _create_rich_text_from_children (node = node )
279-
280- block = UnoCallout (text = "" , icon = Emoji (emoji = "💡" ), color = Color .GREEN )
281- block .rich_text = rich_text
282- return [block ]
285+ return _create_admonition_callout (node = node , emoji = "💡" , color = Color .GREEN )
283286
284287
285288def _map_pygments_to_notion_language (* , pygments_lang : str ) -> CodeLang :
0 commit comments