react-notion-x
react-notion-x copied to clipboard
Use <p> tag for text blocks
Description
Fixes #341
With this PR, the text blocks are rendered as <p> tags in the generated HTML instead of a <div>.
Notion Test Page ID
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Updated |
|---|---|---|---|
| react-notion-x | ✅ Ready (Inspect) | Visit Preview | Aug 4, 2022 at 5:55PM (UTC) |
| react-notion-x-minimal-demo | ✅ Ready (Inspect) | Visit Preview | Aug 4, 2022 at 5:55PM (UTC) |
I don't think it's valid HTML to have any other html elements inside p tag. There cannot be other p tag inside a p tag.
Thanks for the comment @pbteja1998 !
I'm not sure about that but I've seen elements inside <p> tags that are rendered properly. An example is: https://www.startupschool.org/posts/47123
I've also tested this on several notion pages and all of them rendered properly.
I think browsers are smart enough to render everything properly.
But if we follow html spec, then there can't be a p element inside another p element. But again, it doesn't matter, browsers will render everything properly. But ideally, the leaf block element should be p. There can be other inline elements inside p tag though. Just FYI. We don't have to follow the spec.
https://stackoverflow.com/a/9852381