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

Add test for weird side-case #31

Merged
merged 48 commits into from
Jun 29, 2022
Merged

Add test for weird side-case #31

merged 48 commits into from
Jun 29, 2022

Conversation

johndgiese
Copy link
Contributor

@johndgiese johndgiese commented Jun 3, 2022

@xaker00 here's another small PR. See the release notes for some context. It would probably be easiest to review this commit-by-commit.

Ran into this on a real Notion page; it's weird, but Notion let's you
include bolded spaces. For some reason, this is causing our current rich
text handling to crash.
Also improve the log messages in the case that an invalid AST is sent
over to pandoc.
In particular, make it possible for plugins to set the relative
directory where images are stored.
`notion_data` is now used everywhere for the raw data passed in from the
notion API responses.
Move the plugin system over onto the Client class; allow users to use
multiple plugins. All notion classes can now be swapped out.
It's annoying to have to re-run with higher logging levels if something
fails.
@johndgiese johndgiese marked this pull request as ready for review June 5, 2022 15:18
@johndgiese johndgiese requested a review from xaker00 June 5, 2022 15:18
This assumes that these won't take up so much space that RAM will be an
issue. This problem seems a long way away. Once we get there we will
need to use a sqlite database to handle the cache.
Note that we could probably use the MentionRichText.plain_text value to
get the page title, instead of querying the page, but we'll want to
query the page soon enough in order to support linking, thus it's
probablly worth it for now.
Copy link
Collaborator

@xaker00 xaker00 left a comment

Choose a reason for hiding this comment

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

The plugin system looks much more robust now. Good progress. Nothing major stood out. Just some regex improvements in the new builtin plugins. Also there are some flake8 errors.

n2y/plugins/deepheaders.py Outdated Show resolved Hide resolved
result = self.rich_text.matches(self.trigger_regex)
if result:
number_of_equal_signs = len(result.group(1))
self.level += number_of_equal_signs
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens when the level is >6?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good question; as best I can tell, Pandoc's markdown accepts any level of headers (note HTML doesn't as far as I know, but the markdown to html stuff is kind of scope).

n2y/plugins/rawcodeblocks.py Outdated Show resolved Hide resolved
Co-authored-by: Ilya Spivakov <xaker00@gmail.com>
@johndgiese johndgiese merged commit 7855782 into main Jun 29, 2022
@johndgiese johndgiese deleted the rich-text-extensions branch June 29, 2022 13:51
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.

None yet

2 participants