swift-markdown-ui
swift-markdown-ui copied to clipboard
Custom spacing before and after bulleted list
First of all, thank you for this amazing library!
Currently, it is not possible to set custom spacing specifically before and after bulleted list blocks in MarkdownUI. This feature would greatly enhance the ability to control the layout and presentation of lists within the library.
At present, any changes to spacing affect the overall block styles, making it impossible to target only bulleted lists.
Are there any plans to add support for setting custom spacing before and after bulleted list blocks in future updates?
Hi @AlexNsbmr,
You can control top and bottom margins for lists by overriding the current theme's list block style.
Markdown {
"""
A list:
* Item 1
* Item 2
* Item 3
Paragraph after the list.
"""
}
.markdownBlockStyle(\.list) { label in
label.markdownMargin(top: .zero, bottom: .em(0.8))
}
This change applies to all list types: bulleted, numerical and task lists. At the moment there are no plans to allow overriding the style for a single type of list. What is the reasoning behind having different margins depending on the list type?
It only accepts the top and bottom margins, so how about the leading margin before the bullets?
+1 to the left/right margins. Currently it's indented too much.
I'd also like to modify the left/right margins (or however indentation is handled). Specifically, on watchOS it's a waste of space to indent the top-level list... and so I'd like that top-level list to be aligned all the way to the left, and then preferably have a small indentation for every nested list. I've been looking through the codebase, but I don't understand how exactly indentation is handled.