gonzalezreal / swift-markdown-ui

Display and customize Markdown text in SwiftUI
MIT License
2.44k stars 298 forks source link

Image was clipped and stretched with specific markdown text #269

Closed PandaZhang530 closed 11 months ago

PandaZhang530 commented 11 months ago

here is the markdown text :

" Raising the Funds Traditionally\n![](https://academy-public.coinmarketcap.com/optimized-uploads/ac90526718d74b908ac2a967af50339d.png)aa "

here is the screen shot of clipping and stretching:

image
gonzalezreal commented 11 months ago

Hi @PandaZhang530,

I think the problem is the aa text at the end. This causes the image to be laid out next to the text and treated as an inline image, which works differently with images in separate paragraphs. Notice that inline images cannot be styled and are rendered at the original size.

There are a couple of ways to fix this:

  1. Make the image smaller so it can be laid out in line with the text.
  2. Place the image in a different paragraph and remove the aa text.
Raising the Funds Traditionally

![](https://academy-public.coinmarketcap.com/optimized-uploads/ac90526718d74b908ac2a967af50339d.png)

Simulator Screenshot - iPhone 14 - 2023-10-16 at 08 25 22

PandaZhang530 commented 11 months ago

Hi @PandaZhang530,

I think the problem is the aa text at the end. This causes the image to be laid out next to the text and treated as an inline image, which works differently with images in separate paragraphs. Notice that inline images cannot be styled and are rendered at the original size.

There are a couple of ways to fix this:

  1. Make the image smaller so it can be laid out in line with the text.
  2. Place the image in a different paragraph and remove the aa text.
Raising the Funds Traditionally

![](https://academy-public.coinmarketcap.com/optimized-uploads/ac90526718d74b908ac2a967af50339d.png)

Simulator Screenshot - iPhone 14 - 2023-10-16 at 08 25 22

Yes, you are right . I will fix this by adding two line breaks after each markdown image