Closed antonjazz closed 2 years ago
This is definitely a bug. Thanks for reporting, I will look into it.
Thank you! 🙏 And, while you're thinking about it, if you have any ideas about that last comment too (adding a little touch of vertical space between list items) that'd be fantastic! Here's an example (all lines have more spacing except within the wrap-around line). It's subtle but I find that it helps readability a lot:
Thank you! 🙏 And, while you're thinking about it, if you have any ideas about that last comment too (adding a little touch of vertical space between list items) that'd be fantastic! Here's an example (all lines have more spacing except within the wrap-around line). It's subtle but I find that it helps readability a lot:
According to the CommonMark Lists Spec:
A list is loose if any of its constituent list items are separated by blank lines, or if any of its constituent list items directly contain two block-level elements with a blank line between them. Otherwise a list is tight.
MarkdownUI does its best to respect that. So if you write:
1. item one
2. item two
- sublist
- sublist
You will have loose spacing in the outer list.
Likewise, to have loose spacing in both the inner and outer lists, you could write:
1. item one
2. item two
- sublist
- sublist
Is that what you're looking for?
Thanks, Guille! That would work, with these two qualifiers:
loose
to something very small such as 1.0
or 2.0
.(2) is just a minor inconvenience, but I was concerned that achieving (1) would also reduce the spacing between all (non-list) paragraphs to the same small value. Is that correct? So I was hoping that there might be some way I could use MarkdownStyle
to modify the line spacing in normal (tight) lists to make it slightly larger between list items without changing the line spacing within a single, multi-line list item. I couldn't find a way to do that.
Currently you can't achieve the kind of spacing customization you are asking. This will require rewriting some parts of the attributed string renderer.
It's true that the current styling feature is not very flexible. I will consider having better styling support in future releases.
Thanks for the response, Guille! I wish I were good enough with such things to help you with it and submit a pull request instead of an "issue"! Slowly getting there, I hope. :)
Hi @antonjazz, This issue has been fixed in MarkdownUI 1.0.0
Thank you for all the great hard work you've been putting in, @gonzalezreal !!
Hello @gonzalezreal - I was wondering if we can set a custom spacing between list items ?
Let's say I have markdown like this:
Can I set the custom spacing between the list items ?
I tried doing:
someSwiftUIView
.markdownBlockStyle(\.list) { configuration in
configuration.label
.relativeLineSpacing(.em(45))
and
someSwiftUIView
.markdownBlockStyle(\.list) { configuration in
configuration.label
.lineSpacing(45)
Neither of these have any impact.
Answered in #320
I notice that when I have nested lists, I get extra spacing when end I end a sublist. Here's an example of markdown and the MarkDownUI rendering below it, using all standard settings:
Also, I would love to be able to separate all list items slightly (vertically) from each other without increasing the spacing within a multi-line item… but can't figure out how to do that. Any ideas? Thanks!