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

Handle preview embedding better #88

Merged
merged 4 commits into from
Apr 8, 2024

Conversation

ButteredCats
Copy link
Contributor

Of course I happened to discover some bugs after #85 was merged.

  1. The regex matches would sometimes match more than expected depending on how the post was typed out. This would cause parts of the post to get overwritten or merged with the embed. I made the wildcard matches lazy to prevent this.
  2. Gifs would duplicate because the replace parameter wasn't specific enough and would match already existing img blocks. Now it has to match the entirety of <a href="PREVIEW_LINK">TEXT</a> which is then replaced by <a href ="PREVIEW_LINK"><img src="PREVIEW_LINK"></a>
  3. Embedded images in comments wouldn't keep their aspect ratio when the screen got small because I forgot to specify the height attribute as auto. All I did was add that in the CSS.

On top of that I also trashed the if else around the loop as in cases where it's true we end up doing the comparison twice for no reason.

@sigaloid sigaloid merged commit 27f25e0 into redlib-org:main Apr 8, 2024
3 checks passed
@ButteredCats ButteredCats deleted the better_preview_handling branch April 8, 2024 22:38
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