notion-py
notion-py copied to clipboard
Renderers fork
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
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
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)