Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions notion/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,10 @@ class ColumnBlock(Block):

_type = "column"

class TableOfContentsBlock(Block):

_type = "table_of_contents"


class BasicBlock(Block):

Expand All @@ -477,6 +481,27 @@ def convert_to_type(self, new_type):

def _str_fields(self):
return super()._str_fields() + ["title"]

title_list = field_map(
["properties", "title"],
python_to_api=lambda x: [[x]],
api_to_python=lambda x: x,
)

def _get_title(self):
text=""
for list in self.title_list:
if list[0] == "⁍":
text+=list[1][0][1]
else:
text+=list[0]
return text
@property
def title(self):
try:
return self._get_title()
except:
pass


class TodoBlock(BasicBlock):
Expand Down