Skip to content

Commit 6e9db8a

Browse files
authored
Merge pull request #1 from babylist/fix/visitListItem-protocol-dispatch
Fix visitListItem not being called by MarkupVisitor protocol dispatch
2 parents 5996fba + 29ea947 commit 6e9db8a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Sources/MarkdownToAttributedString/AttributedStringVisitor.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,13 @@ struct AttributedStringVisitor: MarkupVisitor {
306306
}
307307

308308

309+
// Satisfies the single-parameter MarkupVisitor protocol requirement so that
310+
// protocol dispatch (e.g. markup.accept(&self)) resolves to this type's
311+
// implementation rather than the default provided by the protocol extension.
312+
mutating func visitListItem(_ listItem: ListItem) {
313+
visitListItem(listItem, orderedIndex: nil)
314+
}
315+
309316
// orderedIndex is non-nil when part of an ordered list
310317
mutating func visitListItem(_ listItem: ListItem, orderedIndex: Int? = nil) {
311318
guard optionsSupportEl(.listItem) else {

0 commit comments

Comments
 (0)