Paragraph styling similar to NSParagraphStyle #194
-
Hi there! Is there a way to style a paragraph of text similar to |
Beta Was this translation helpful? Give feedback.
Answered by
gonzalezreal
Feb 27, 2023
Replies: 1 comment 3 replies
-
Hi @hc-admin, There is no
Currently, there is no equivalent modifier to set the first line head indent. To override the current paragraph style, you can use the Markdown {
"""
The sky above the port was the color of television, tuned to a dead channel.
It was a bright cold day in April, and the clocks were striking thirteen.
"""
}
.markdownBlockStyle(\.paragraph) { label in
label
// Adjust the paragraph spacing
.markdownMargin(top: .zero, bottom: .em(1.5))
// Adjust the head indent
.relativePadding(.leading, length: .em(0.5))
// Adjust the tail indent
.relativePadding(.trailing, length: .em(1))
// Adjust the line spacing
.relativeLineSpacing(.em(0.25))
// Adjust the text alignment
.multilineTextAlignment(.center)
} |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
gonzalezreal
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @hc-admin,
There is no
NSParagraphStyle
equivalent in MarkdownUI, but you can achieve most of its functionality using view modifiers. More specifically:markdownMargin(top:bottom:)
modifier to adjust the paragraph spacing.padding(_:_:)
modifier to adjust the head and tail indents. MarkdownUI provides therelativePadding(_:length:)
modifier if you want to use font-relative lengths.lineSpacing(_:)
modifier to adjust the amount of space between lines. Again, MarkdownUI provides therelativeLineSpacing(_:)
modifier if you want to use font-relative lengths.multilinetextalignment(_:)
modifier to adjust the text alignment.Currently, there is no e…