Skip to content

Commit 92f4aa0

Browse files
committed
MarkdownStyles.unorderedListBullets allows customizing unordered list bullets
1 parent e0e5a2a commit 92f4aa0

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

Sources/MarkdownToAttributedString/AttributedStringVisitor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,9 @@ struct AttributedStringVisitor: MarkupVisitor {
278278
let renderedDelimiter: String
279279
if let index = index {
280280
prefix = "\(index). "
281-
renderedDelimiter = ""
281+
renderedDelimiter = markdownStyles.unorderedListBullets[0]
282282
} else {
283-
let bullets = ["", "", "", ""]
283+
let bullets = markdownStyles.unorderedListBullets
284284
renderedDelimiter = bullets[listItem.listDepth % bullets.count]
285285
let tabs = String(repeating: "\t", count: listItem.listDepth + 1)
286286
prefix = tabs + renderedDelimiter + " "

Sources/MarkdownToAttributedString/MarkdownStyles.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ import Markdown
2424
/// - headingPointSizes: An array of `CGFloat` values specifying font sizes for headings. The first value applies
2525
/// to level 1 headings (`#`), the second to level 2 headings (`##`), and so on. If there are fewer values than
2626
/// heading levels, the last size in the array is reused for remaining levels.
27+
///
28+
/// - unorderedListBullets: An array of "bullet" strings to be used for unordered lists. The index of the array = the indentation of the list item, wrapping back to the 1st if the indentation > array.count.
2729
public struct MarkdownStyles {
2830
public var baseAttributes: StringAttrs
2931
public var styleAttributes: [MarkupType: StringAttrs]
3032
public var headingPointSizes: [CGFloat] = [22, 18, 15, 14, 13, 11]
33+
public var unorderedListBullets: [String] = ["", "", "", ""]
3134

3235
public init(baseAttributes: StringAttrs, styleAttributes: [MarkupType : StringAttrs]) {
3336
self.baseAttributes = baseAttributes

0 commit comments

Comments
 (0)