-
-
Notifications
You must be signed in to change notification settings - Fork 269
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
preserve space in certain elements #429
Conversation
Hi @idoshamun, I also think that's the idea. My remarks:
|
@adbar good catch! I applied the changes please check again |
@adbar would you mind suggesting the next step? |
@idoshamun Sorry, I missed your last comment. The tests don't pass, do we need to adapt them to your changes or change the code further? That would be the next step IMO. |
@adbar this is exactly my debate, not sure if I need to adjust the tests or my code. Can you have a look and let me know your suggestion please? |
Hi @idoshamun, yes, the code makes sense so I'd start with the tests, I'm not sure why they fail. |
@adbar it's ready for your review! |
Thanks, I need to check the impact on general performance (accuracy and speed) so it's going to take a bit of time. I'm not completely sure regarding tables but this is the way to go for code segments. Just to clarify: you inserted |
Yap. Let me know if I can help with something :) |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #429 +/- ##
==========================================
+ Coverage 96.82% 96.84% +0.01%
==========================================
Files 22 22
Lines 3342 3361 +19
==========================================
+ Hits 3236 3255 +19
Misses 106 106 ☔ View full report in Codecov by Sentry. |
So, the changes pass the tests, including on my benchmark, they are also not critical for performance. Thanks for the PR! I thought we could maybe make it better:
|
Thanks a lot for checking and the effort @adbar!
I can suggest a different approach then, whenever we detect a new preserve space element, we'd propagate down an attribute to indicate we need to preserve space to every child element. This way all the tree will preserve space. Let me know if I should go down this path.
You're right. I'll add the pre element to the set.
Once you decide to apply this strategy we can consider it. But if it's not a common pattern in the library currently than I suggest we skip this one. Wdyt? |
The way we perform tree traversal is crucial because it can save time. I was just curious if elements such as Yes, please add We can see the configuration/options later, no worries. |
@adbar done! |
I still get this I believe it's about statements like |
Another issue, the XML output is garbled instead of pretty-printed because of the PR but there is not test for that and I'm not sure why. |
@adbar I'm not sure exactly what I should change. Can you perhaps apply the fix please? |
OK, I'll take it from here and try to restore parts of the removed code and to avoid the warnings. |
Thanks a lot @adbar for the support! |
In the coming weeks. |
It's still WIP but @adbar, I need your advice and early review to see that I'm heading the right direction.
Currently I manage to preserve spaces in code elements but it breaks proper formatting in other elements. You can see the test cases. I'm not sure what will be the right way to address these cases.
It's mostly where
<p>H <hi>i</hi>, <hi>w</hi></p>
.Basically content elements (p, item, etc) should preserve spaces as well I think
Closes #422