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.
Fix1:
When evaluating container tags (like
div
orp
) they always have a break line before them. Which in general is what we want. But when the container tag is at the start, this would lead to an empty line before it.So for example this
<div>This is one line</div>
is evaluated as:
instead of (notice that there is to empty line above):
Or more importantly this:
would create something like this:
Item
Item
Fix2:
Having something like this
A<br><br><br>B
would be evaluated as:instead of:
I hope this is helpful for you :)
Disclaimer 1:
I tested my changes with data from the app, where the library is used and I am content that it works as expected.
But I did not run (or fix) any UnitTests because my knowledge of pure library development is limited.
Disclaimer 2:
In case Fix 2 breaks intended behaviour, you can just revert my change in this line:
https://github.com/JodliDev/ZMarkupParser/blob/2c6a74edc37678efd888d41c07bcdab7d0500bab/Sources/ZMarkupParser/Core/Processor/MarkupNSAttributedStringVisitor.swift#L23