Skip to content

Unordered list items render without bullets #5

@SkylerSea

Description

@SkylerSea

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions