-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add basic handling for nested lists #23
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We've seen a slow but continual stream of errors related to markdown rendering of nested lists. We'd like to offer at least a basic solution to this common use case. The output of this change isn't valid markdown, but represents a human- readable result, which is at least a step forward.
RohanM
force-pushed
the
16814-upmark-add-basic-nested-list-handling
branch
from
April 19, 2024 00:48
a6a7327
to
8f1d9b9
Compare
tiagoamaro
approved these changes
Apr 19, 2024
expect(html).to convert_to("1. 1. List item") | ||
end | ||
end | ||
end |
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.
Checking out these new tests to the main
branch will raise the following errors in the test suite, as expected:
╰─$ bundle exec rspec
Randomized with seed 12685
..F................F..........................................................................
Failures:
1) Upmark.convert nested unordered lists generates readable output
Failure/Error: children = element[:children].map {|value| value.strip != "" ? value : nil }.compact
NoMethodError:
undefined method `strip' for ["* List item\n"]:Array
# ./lib/upmark/transform/markdown.rb:51:in `block (2 levels) in <class:Markdown>'
# ./lib/upmark/transform/markdown.rb:51:in `map'
# ./lib/upmark/transform/markdown.rb:51:in `block in <class:Markdown>'
# ./lib/upmark/transform_helpers.rb:22:in `block (2 levels) in element'
# ./lib/upmark.rb:20:in `convert'
# ./spec/acceptance/upmark_spec.rb:8:in `actual'
# ./spec/acceptance/upmark_spec.rb:4:in `block (3 levels) in <top (required)>'
# ./spec/acceptance/upmark_spec.rb:357:in `block (3 levels) in <top (required)>'
2) Upmark.convert nested ordered lists generates readable output
Failure/Error: children = element[:children].map {|value| value.strip != "" ? value : nil }.compact
NoMethodError:
undefined method `strip' for ["1. List item\n"]:Array
# ./lib/upmark/transform/markdown.rb:56:in `block (2 levels) in <class:Markdown>'
# ./lib/upmark/transform/markdown.rb:56:in `map'
# ./lib/upmark/transform/markdown.rb:56:in `block in <class:Markdown>'
# ./lib/upmark/transform_helpers.rb:22:in `block (2 levels) in element'
# ./lib/upmark.rb:20:in `convert'
# ./spec/acceptance/upmark_spec.rb:8:in `actual'
# ./spec/acceptance/upmark_spec.rb:4:in `block (3 levels) in <top (required)>'
# ./spec/acceptance/upmark_spec.rb:373:in `block (3 levels) in <top (required)>'
Finished in 0.08328 seconds (files took 0.08653 seconds to load)
94 examples, 2 failures
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://app.bugsnag.com/the-conversation/tc/errors/6576cc832f734a0008ef8789?filters[error.status]=open&filters[event.since]=30d
We've seen a slow but continual stream of errors related to markdown rendering of nested lists. We'd like to offer at least a basic solution to this common use case. The output of this change isn't valid markdown, but represents a human-
readable result, which is at least a step forward.
Before:
After: