Let me know if you have something specific in mind and I can think of a more contextual answer / example snippet. I used the Quarto custom theming recently for a project, in combination with the ‘nbdev_preview’ command its super easy and fast to get write what you want since you can see the impact of your code straight away.
Thanks @nglillywhite for your reply, that should probably work indeed. I was hoping for something more “easy”, e,g. by using some parameter in the metadata or something, but perhaps that’s just not possible.
I find the quarto custom theming so nice and easy, I’ve used it for other stylistic changes but its great to see how simple it is to modify the cell output, this is really nice reference to come back to, thanks!
Following your solution, I used the following css to format the output cell. However, some of the output lines are generated as separate chunks, rather than shown in one output cell, as shown below.
May I ask how to edit the css file to remove the gaps between the output cells?
Another way this can be done, without diving into styling, is to use the IPython Markdown class — though this method may not be as good if you want to use it for all code cells or if you want the code cells to be visible.
from IPython.display import display, Markdown
display(Markdown(f'''
`{a[0, :].shape, b.shape}`
'''))
This’ll print the output of a[0, :].shape, b.shape with Markdown syntax highlighting.
I think the code snippet above can be further simplified by omitting the display function.
Using your css, the output of the two consequtive print() are not separated by a gap. However, this still doesn’t work for the output of pytorch traning shown in my example quarto book.
@oat Perhaps try to inspect what element is being placed in between the output text, check the class and add the same css styles as you have for your output text on that element and class in the custom css file?