Skip to content

Merge blocks with same type together and handle Notion limits on children and text length #7

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 5 commits into
base: main
Choose a base branch
from

Conversation

gadelkareem
Copy link

No description provided.

Copy link
Owner

@trustmaster trustmaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't aware of the children limit, so thanks for bringing it up.

Unfortunately the current implementation breaks all bulleted and numbered lists as those need to have items as separate Notion blocks.

Could you consider merging similar text blocks together after parsing the blocks?

@gadelkareem
Copy link
Author

I limited merging the blocks only to text types

Copy link
Owner

@trustmaster trustmaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a tiny bug in the latest revision.

Also, after playing a bit more with this behaviour, I think that merging paragraphs to bypass the block count limitation should rather be a config option, e.g.:

[notion]
merge_paragraphs=False

because the native behaviour to Notion is to have each paragraph as a separate block. Merging all paragraphs in one block by default makes editing less convenient.

@gadelkareem
Copy link
Author

Added!

Copy link
Owner

@trustmaster trustmaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs just one last touch, adding the option to the Config object at line 183:

        self.merge_paragraphs = ini['notion']['merge_paragraphs'].lower(
        ) == 'true'

with that change in place everything works like a charm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants