Skip to content

Numbered lines inside each Unordered list item getting parsed as Ordered list instead of simple string #208

@ronit-volare

Description

@ronit-volare

I implemented the UI layer of Markdown and I am facing an issue with the way it is getting parsed.

  • Here is the sample input:
- 1. hello
- 2. world
- 3. something

Problem for "- 1. hello" in the first line of sample

  • I am getting OrderedList type of ListItem (after typecasting to any Markup) while visiting it, it should ideally return native string type for "1. hello" part.

What I get in iOS (please pardon the formatting, not perfect yet):

What it should ideally look like:

Implementation context:

  • I currently have v0.5.0, latest version.
  • I am simply getting an attributed string from my custom implementation of Node visits, here is the flow:
let document = Document(parsing: postBody)
self.body.attributedText = self.markdownHelper.attributedString(from: document)
public struct SwiftMarkdownHelper: MarkupVisitor { ///custom implementation of node visitor
extension SwiftMarkdownHelper {
    mutating public func visitUnorderedList(_ unorderedList: UnorderedList) -> NSAttributedString {

We need to fix this bug, please point me in the right direction for a fix or if someone can help it will be highly appreciated.

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