gonzalezreal / swift-markdown-ui

Display and customize Markdown text in SwiftUI
MIT License
2.53k stars 318 forks source link

Line spacing does not work #246

Closed petkrein closed 1 year ago

petkrein commented 1 year ago

Line spacing doesn't seem to work. Neither '.lineSpacing(1.2)' nor via your custom view modifier '.relativeLineSpacing(.em(0.9))'.

It would be nice if you show me how to manipulate the line spacing.

Example 1:

 Markdown(self.content)
       .lineSpacing(1.5)

Bildschirmfoto 2023-08-02 um 17 57 00

Example 2:

Markdown(self.content)
       .relativeLineSpacing(RelativeSize.em(0.9))

Bildschirmfoto 2023-08-02 um 17 47 39

Version information

gonzalezreal commented 1 year ago

Hi @petkrein,

Please consider that a Markdown view comprises multiple subviews (usually text, images, and containers), so the lineSpacing modifier might not work as you expect when you apply it directly to it.

Instead, you can make these customizations at a block level (paragraph, heading, etc.), which is very powerful because you can customize the line spacing, the top and bottom margins, and many other things.

This post will give you all the details.

Since this is not an issue, I am moving it to a discussion in case you want to follow up with more questions.