Skip to content

Commit

Permalink
fix(ad-hoc): markdown nested lists (#124)
Browse files Browse the repository at this point in the history
* Fix nested list item head indentation
* Opt out of lists system formatting logic on iOS 16
  • Loading branch information
andrii-vysotskyi-cko authored Jun 27, 2023
1 parent 86ac67f commit 3c73036
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ struct AttributedStringBuilder {
/// Allows to alter font with the specified symbolic traits.
var fontSymbolicTraits: UIFontDescriptor.SymbolicTraits = []

/// The text lists that contain text.
var textLists: [NSTextList] = []

/// The text tab objects that represent the paragraph’s tab stops.
var tabStops: [NSTextTab] = []

Expand Down Expand Up @@ -83,7 +80,6 @@ struct AttributedStringBuilder {
paragraphStyle.paragraphSpacing = typography.paragraphSpacing
paragraphStyle.alignment = alignment
paragraphStyle.lineBreakMode = lineBreakMode
paragraphStyle.textLists = textLists
paragraphStyle.tabStops = tabStops
paragraphStyle.headIndent = headIndent
attributes[.paragraphStyle] = paragraphStyle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ final class AttributedStringMarkdownVisitor: MarkdownVisitor {
func visit(list: MarkdownList) -> NSAttributedString {
var builder = self.builder
let textList = textList(list)
builder.textLists.append(textList)
builder.tabStops += listTabStops(textList, itemsCount: list.children.count)
if let tabStop = builder.tabStops.last {
builder.headIndent += tabStop.location
builder.headIndent = tabStop.location
}
let itemsSeparator = NSAttributedString(string: Constants.paragraphSeparator)
let attributedString = list.children
Expand Down

0 comments on commit 3c73036

Please sign in to comment.