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

Renderers fork #93

Draft
wants to merge 12 commits into
base: renderers
Choose a base branch
from
Draft

Renderers fork #93

wants to merge 12 commits into from

Conversation

Cobertos
Copy link

@Cobertos Cobertos commented Jan 9, 2020

Adds HTMLRenderer to notion-py, from @jamalex 's original PR

I rewrote the original PR with dominate. This makes it much easier to add attributes and combine elements while rendering.

I also removed all the internal styles. I'd rather we add class names and let the user make their own stylesheet. If absolutely necessary, we could provide a StyledHTMLRenderer that outputs a default stylesheet in a <style> tag along with the HTML or make it a flag

I also added unit tests for this with pytest for my own sanity.

Let me know of your thoughts.

TODO:

  • Add mistletoe, dominate, pytest and any others as dependencies to this package
  • Make the interface more like BaseRenderer
  • Finish filling in all the placeholders
  • Create a comprehensive test for all Notion block types if possible

@samarthdave
Copy link

samarthdave commented May 9, 2022

Hello, what else needs to be done here to use the native web "Export as HTML" feature? Referred here from #178

Edit: Ideally something like this: https://pypi.org/project/notion-backup

@Cobertos
Copy link
Author

Cobertos commented May 9, 2022

Hello, what else needs to be done here to use the native web "Export as HTML" feature? Referred here from #178

Edit: Ideally something like this: https://pypi.org/project/notion-backup

I think the arturtsmborski fork might have more work.

You would need to finish the TODOs above (there's some missing unhandled blocks), write some css for the output html (because I never got as far as styling anything, I think it was originally meant to be optional, so you could have structured html without any styling if you wanted to style it yourself), and test it against all the Notion block types (because there's a lot of corner cases)

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