react-notion-x icon indicating copy to clipboard operation
react-notion-x copied to clipboard

Use <p> tag for text blocks

Open MartinXPN opened this issue 3 years ago • 4 comments
trafficstars

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

MartinXPN avatar Aug 04 '22 17:08 MartinXPN

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)

vercel[bot] avatar Aug 04 '22 17:08 vercel[bot]

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.

pbteja1998 avatar Aug 04 '22 23:08 pbteja1998

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.

MartinXPN avatar Aug 05 '22 05:08 MartinXPN

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

pbteja1998 avatar Aug 05 '22 05:08 pbteja1998