Skip to content

fix: used textwrap indent for indentation of child block #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
7 changes: 2 additions & 5 deletions notion2md/convertor/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import urllib.request as request
from urllib.parse import urlparse,unquote
from textwrap import indent

from cleo.io.io import IO

Expand Down Expand Up @@ -30,7 +31,6 @@ def convert(self, blocks: dict) -> str:
def convert_block(
self,
block: dict,
depth=0,
):
outcome_block: str = ""
block_type = block["type"]
Expand All @@ -56,19 +56,16 @@ def convert_block(
pass
# create table block
elif block_type == "table":
depth += 1
child_blocks = self._client.get_children(block["id"])
outcome_block = self.create_table(cell_blocks=child_blocks)
# create indent block
else:
depth += 1
child_blocks = self._client.get_children(block["id"])
for block in child_blocks:
converted_block = self.convert_block(
block,
depth,
)
outcome_block += "\t" * depth + converted_block
outcome_block += indent(converted_block, '\t')
except Exception as e:
if self._io:
self._io.write_line(
Expand Down