-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Blank <p>
added between "Tweet" embeds
#65
Comments
Narrowed down the issue to the usage of It seems to be sensitive to the kinds of elements present in the inner HTML. For instance this (using
Produces the markup you'd expect:
But this (using
Produces this with the
|
Thanks for the report and the investigation! This is actually an issue with HTML parsing. If you look at the HTML generated, it looks like this: <p>
<astro-embed-tweet>
<blockquote class="twitter-tweet" data-dnt="true">
<p lang="en" dir="ltr">Tweet</p>
— Username (@handle) <a href="...">Month D, YYYY</a>
</blockquote>
</astro-embed-tweet>
</p> The problem is that
So the result is: <p>
<astro-embed-tweet>
</astro-embed-tweet>
</p>
<blockquote class="twitter-tweet" data-dnt="true">
<p lang="en" dir="ltr">Tweet</p>
— Username (@handle) <a href="...">Month D, YYYY</a>
</blockquote> Whether or not you get the large gaps, depends on your CSS (in your reproduction I’ll note this is only an issue with the import { Tweet } from 'astro-embed'
<Tweet id="https://twitter.com/astrodotbuild/status/1511750228428435457" /> We can probably fix the |
When multiple Twitter links appear in an MDX file, there is a blank
<p>
tag between them, which can create awkward gaps on the page when markdown is styled.Minimal Reproduction:
https://codesandbox.io/p/sandbox/astro-embed-tweets-extra-p-issue-4z4zq3?file=%2Fsrc%2Fpages%2Findex.mdx%3A1%2C1
Notice how there is a large gap between the two tweets, but the gap is not present between YouTube embeds.
2x Tweets markup (each item is prefaced by a blank
<p><astro-embed-tweet></p>
and followed by a blank<p></p>
:2x YouTube markup (each item is in a single
<p>
:I would like the Tweet embed to behave similar to the YouTube one, so it just lives under a single element for consistent spacing.
The text was updated successfully, but these errors were encountered: