visitListItem(_:orderedIndex:) has a second defaulted parameter, which means it doesn't satisfy the MarkupVisitor protocol requirement visitListItem(_:). When Swift resolves protocol dispatch via markup.accept(&self), it calls the default extension implementation (which falls through to defaultVisit) instead of the concrete implementation. This causes list item prefixes (bullets/numbers) to be silently dropped and newlines between items to be lost.
To reproduce:
let result = AttributedStringFormatter.format(markdown: "- Item one\n- Item two")
print(result.string) // "Item oneItem two\n" — no bullets, items concatenated
Expected:
print(result.string) // "\t• Item one\n\t• Item two\n"
Tests:
testListEquality fails on main. The assertion produces "li\nli\nlilili\n" instead of the expected prefixed output, and then crashes on a force-unwrap.
Fix:
#4
visitListItem(_:orderedIndex:)has a second defaulted parameter, which means it doesn't satisfy the MarkupVisitor protocol requirementvisitListItem(_:). When Swift resolves protocol dispatch viamarkup.accept(&self), it calls the default extension implementation (which falls through to defaultVisit) instead of the concrete implementation. This causes list item prefixes (bullets/numbers) to be silently dropped and newlines between items to be lost.To reproduce:
Expected:
print(result.string) // "\t• Item one\n\t• Item two\n"Tests:
testListEqualityfails on main. The assertion produces "li\nli\nlilili\n" instead of the expected prefixed output, and then crashes on a force-unwrap.Fix:
#4