-
Notifications
You must be signed in to change notification settings - Fork 406
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
join newlines with spaces in Html.__format__ #3882
join newlines with spaces in Html.__format__ #3882
Conversation
Previously, newlines were effectively removed when formatting an Html object. This breaks in cases where html tags are split across multiple lines. For example, Html(""" <div style="..." ></div> """)
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
recheck |
thank you! ill follow up with some tests |
actually, i'm not sure if this will create other issues. cc @akshayka who has more context on this |
This is definitely a bug, and your fix does fix this. Example notebook here But i wonder if we should just not be stripping newlines, because it could also lose info, such as new lines help display something. Maybe a better solution is that we don't override |
i added a few more test cases to show off the current behaviour |
marimo/_output/hypertext.py
Outdated
return " ".join( | ||
[line.strip() for line in self.text.split("\n")] | ||
).strip() |
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.
i would personally strip before splitting rather than stripping after joining
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.
👍 will do
🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.11.9-dev6 |
📝 Summary
Fixes a bug in
Html.__format__
when the provided html text has newlines inside an html tag.🔍 Description of Changes
Previously, newlines were effectively removed when formatting an Html object. This breaks in cases where html tags are split across multiple lines. For example,
📋 Checklist
📜 Reviewers
@akshayka OR @mscolnick