-
Notifications
You must be signed in to change notification settings - Fork 197
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
Improve multiple depth levels list parsing (second attempt!) #71
base: master
Are you sure you want to change the base?
Conversation
faab276
to
bcc9f21
Compare
(Messed up my rebase, and accidentally closed the PR 🤦♂️ . Should be OK now...) |
Lets please have this merged 🙏🏻 |
Sorry to leave this here but I couldn't find a way to just report an issue. I noticed that with the list parser, you can create unordered lists like this:
And it works fine. However, ordered lists do not work if there isn't a blank line after the header.
Doesn't work but
Does work. Also, I noticed that headers don't work if there's not a space after the hash marks which I can't tell if that's part of the spec or not. |
@JohnSundell Please merge this, it has tests and looks good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
This seems like it is missing something from #53, namely the lines:
Thus, for example, the following Markdown is incorrectly parsed:
Which is parsed as:
|
I have to double-check then because I added a test that checks for exactly this (I‘m here because this bug troubles me) and the test worked with this patch only. But maybe I got lost somewhere. |
@mkassoff : I cannot confirm what you've said, the tests that are added "should" cover your cases since there are more complicated nestings covered which are parsed correctly. To double-check, I've 1:1 checked your example as a test case: let html = MarkdownParser().html(from: """
- Fruit
- Apple
- Dairy
""")
let expectedComponents: [String] = [
"<ul>",
"<li>Fruit",
"<ul>",
"<li>Apple</li>",
"</ul>",
"</li>",
"<li>Dairy</li>",
"</ul>"
]
XCTAssertEqual(html, expectedComponents.joined()) and it runs just fine as well on this PR. |
This is another attempt to merge PR #53, created by @zntfdr.
Their original PR received no love, and I'm hoping that @JohnSundell might see this second attempt :)
Why am I making a new PR for somebody else's code?
Thank-you, John, for taking the time to consider this PR! 🤞