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
Margins in text lines in Jupyter HTML template #3335
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
We are using Rich for logging (
from rich.logging import RichHandler
), and I have a few questions about its text formatting in Jupyter notebooks. First, it seems to be adding a large spacing between lines.Notebook output:
With especially large spacing after the progress bar widget.
Compared that to a standard text output:
Looking at the HTML source code, Jupyter seems to be adding a margin-bottom to the child elements of
.jp-RenderedHTMLCommon
(in this case, each line is a singlepre
element inside the wrapper, so the.jp-RenderedHTMLCommon > *:last-child { margin-bottom: 0.5em }
takes effect. I'm not sure if we have control over Jupyter CSS, but it seems like overriding the style of thepre
element set inJUPYTER_HTML_FORMAT
helps to remove the vertical spacing:Let me know if that makes sense. Since users can override
JUPYTER_HTML_FORMAT
, there is no urgency in changing it in the code or making it explicitly user-configurable. But it probably would be nice to hardcodemargin-bottom:0px
there.There is still an issue remaining with the widgets though. In my example, the
searching
line is not printed by the logging's RichHandler, but rather it's an instance ofrich.progress.Progress
. So in this case, thepre
element is additionally wrapped in a.jupyter-widgets
div that has{ margin: var(--jp-widgets-margin) }
, which adds an additional margin-left, making the progress bar unaligned with the log prints vertically. I wonder if you have ideas on how to fix that as well?The text was updated successfully, but these errors were encountered: