Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ronit-volare opened this issue Dec 4, 2024 · 0 comments

Comments

@ronit-volare
Copy link

ronit-volare commented Dec 4, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant