Class: NotionToMd::Blocks::NumberedListItemBlock

Inherits:
BulletedListItemBlock show all
Defined in:
lib/notion_to_md/blocks/numbered_list_item_block.rb

Instance Attribute Summary

Attributes inherited from Block

#block, #children

Instance Method Summary collapse

Methods inherited from BulletedListItemBlock

#indent_children, #newline

Methods inherited from Block

#initialize

Constructor Details

This class inherits a constructor from NotionToMd::Blocks::Block

Instance Method Details

#to_md(tab_width: 0, index: nil) ⇒ Object

Parameters:

tab_width

The number of tabs used to indent the block.

index

The index of the block in its parent’s children array used to number the item.

Returns

The current block (and its children) converted to a markdown string.



17
18
19
20
21
22
23
# File 'lib/notion_to_md/blocks/numbered_list_item_block.rb', line 17

def to_md(tab_width: 0, index: nil)
  md = Types.numbered_list_item(block[block.type.to_sym], index) + newline
  md + build_nested_blocks(tab_width + 1)
rescue NoMethodError
  Logger.info("Unsupported block type: #{block.type}")
  nil
end