Skip to content
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

Create an n2y plugin to replaced link blocks with the content of the linked page #66

Closed
4 of 8 tasks
johndgiese opened this issue Aug 30, 2022 · 0 comments
Closed
4 of 8 tasks
Assignees
Labels

Comments

@johndgiese
Copy link
Contributor

johndgiese commented Aug 30, 2022

In Notion there are a few types of links. One of them, called a link_to_page block: https://developers.notion.com/reference/block#link-to-page-blocks

The default behavior of n2y is to just display a warning if one of these is used:

n2y/n2y/blocks.py

Lines 518 to 519 in 76c802d

class LinkToPageBlock(WarningBlock):
pass

We'd like to create an n2y plugin that will over-ride the default behavior for the link_to_page block such that each time it occurs, the content of the page that's linked to is inserted into in place of the block.

Steps to complete:

  • Read through the README

  • Install the code locally and ensure all of the tests are passing

  • Read about the plugin system code, and in the readme, and browse through the existing plugins in the codebase

  • Following our git and PR SOP, including creating logical commits with good commit messages, and create a PR that creates a new plugin that performs as discussed. If you have any questions about details in that SOP, please ask me.

  • Update the existing plugin end-to-end test (including updating the associated notion page's content---see the end to end test docstrings) to include a link_to_page block and assert that the content is expanded.

  • Handle the case where the plugin doesn't have permission to access the linked page; in this case, log a warning including a link to the notion block where it occurred (grep for logger.warning for examples).

  • Update the end-to-end test to cover the case where we don't have permissions.

  • If a link goes to a database, just log a warning and ignore it. Be sure to include a link to the notion block where the warning occurred.

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

No branches or pull requests

2 participants