gonzalezreal / swift-markdown-ui

Display and customize Markdown text in SwiftUI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Line spacing does not work

petkrein opened this issue · comments

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

  • MarkdownUI: [2.0.0]
  • OS: [iOS 16.4, macOS 13.5]
  • Xcode: [14.3.1]

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.