Manuals Notion Ruby Mapping Public API Reference (https://hkob.notion.site/Notion-Ruby-Mapping-Public-API-Reference-4091aca15b664299b63e6253b7601fec) NotionRubyMapping idea note (https://hkob.notion.site/NotionRubyMapping-idea-note-3b0a3bb3c171438a830f9579d41df501)
Examples 無題 (https://hkob.notion.site/d30033e707194faf995741167eb2b6f8) Append block children sample (https://hkob.notion.site/Append-block-children-sample-3867910a437340be931cf7f2c06443c6) 無題 (https://hkob.notion.site/5568c1c36fe84f12b83edfe2dda83028)

<aside> 💡 This page was created for testing NorionRubyMapping. I thought this page was best suited to explain the append_child_block API, so I am presenting it as a use case.

</aside>

<aside> ℹ️ ↑ Table of Contents

</aside>

<aside> 💡 append_block_chidren can be used to Page and Blockobject. In this callout, there are some examples for appending blocks to block. examples for appending blocks to page are described under the callout.

Append block children for Block

Here is a paragraph block for test of append block children for a block. This block is obtained as org_block as follows. Moreover, a test sub_block object is generated by Block.new.paragraph method.

org_block = Block.find "82314687163e41baaf300a8a2bec57c2" # This callout block's id
sub_block = ParagraphBlock.new "with children"

block = XXXBlock.new(some arguments....) # create a block object
org_block.append_block_children block # call append_block_children API

From here, the code to create a block and its products are shown side by side. The each mention link of Block after “→” is the link to the method reference.


1. BookmarkBlock

block = BookmarkBlock.new "<https://www.google.com>", caption: "Google"

Google

↑ Table of Contents


2. BreadcrumbBlock

block = BreadcrumbBlock.new

↑ Table of Contents


3. BulletedListItemBlock

block = BulletedListItemBlock.new "Bullet list item", color: "green", sub_blocks: sub_block

↑ Table of Contents


4. CalloutBlock (emoji)

block = CalloutBlock.new "Emoji callout", emoji: "✅", color: "blue", sub_blocks: sub_block

<aside> ✅ Emoji callout

with children

</aside>

↑ Table of Contents


5. CalloutBlock (file_url)

block = CalloutBlock.new "Url callout", file_url: "<https://img.icons8.com/ios-filled/250/000000/mac-os.png>", sub_blocks: sub_block

<aside> <img src="https://img.icons8.com/ios-filled/250/000000/mac-os.png" alt="https://img.icons8.com/ios-filled/250/000000/mac-os.png" width="40px" /> Url callout

with children

</aside>

↑ Table of Contents


6. CodeBlock

block = CodeBlock.new "% ls -l", caption: "List files", language: "shell"
% ls -l

↑ Table of Contents


7. ColumnListBlock

block = ColumnListBlock.new [
  CalloutBlock.new("Emoji callout", emoji: "✅"),
  CalloutBlock.new("Url callout", file_url: "<https://img.icons8.com/ios-filled/250/000000/mac-os.png>"),
]

<aside> ✅ Emoji callout

</aside>

<aside> <img src="https://img.icons8.com/ios-filled/250/000000/mac-os.png" alt="https://img.icons8.com/ios-filled/250/000000/mac-os.png" width="40px" /> Url callout

</aside>

↑ Table of Contents


8. DividerBlock

block = DividerBlock.new

↑ Table of Contents

9. EmbedBlock

block = EmbedBlock.new "<https://twitter.com/hkob/status/1507972453095833601>", caption: "NotionRubyMapping開発記録(21)"

NotionRubyMapping開発記録(21)

NotionRubyMapping開発記録(21)

↑ Table of Contents


10. EquationBlock

block = EquationBlock.new "x = \\\\frac{-b\\\\pm\\\\sqrt{b^2-4ac}}{2a}"

$$ x = \frac{-b\pm\sqrt{b^2-4ac}}{2a} $$

↑ Table of Contents


11. FileBlock

block = FileBlock.new "<https://img.icons8.com/ios-filled/250/000000/mac-os.png>", caption: "macOS icon"

macOS icon

macOS icon

↑ Table of Contents


12. Heading1Block

block = Heading1Block.new "Heading 1", color: "orange_background"

Heading 1

↑ Table of Contents


13. Heading2Block

block = Heading2Block.new "Heading 2", color: "blue_background"

Heading 2

↑ Table of Contents


14. Heading3Block

block = Heading3Block.new "Heading 3", color: "gray_background"

Heading 3

↑ Table of Contents


15. ImageBlock

block = ImageBlock.new "<https://cdn.worldvectorlogo.com/logos/notion-logo-1.svg>", caption: "Notion logo"

Notion logo

Notion logo

↑ Table of Contents


16. LinkToPageBlock

block = LinkToPageBlock.new page_id: "c01166c613ae45cbb96818b4ef2f5a77"

notion_ruby_mapping_test_data

</aside>