ENH Add CSS for pandas dataframe
See original GitHub issueWith #541, Sphinx-Gallery can capture raw HTML (using the _repr_html_()
of an object) and embed in rst. In some cases, where the captured raw HTML does not include CSS (e.g. pandas dataframes), this can be added to make the output look better. For reference this (scroll down) is what a pandas dataframe looks like with just the raw HTML.
For example, Jupyter notebook seems to take CSS from their own renderedhtml.less
(see @larsoner’s post). For reference this SO question describes how to get pandas dataframes to look like those in Jupyter notebook.
One solution is that we can include our own CSS for common objects like pandas dataframes (I think this might be beyond the scope of SG).
~Another solution is to obtain CSS from the objects we capture _repr_html_
from, if possible.~
Another solution would be to add a add_css
configuration to allow the user add their own CSS file (e.g. pandas dataframes have specific HTML tags that can be used to write CSS specifically for dataframes), a reference to which would be added at the end of raw HTML embedded.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:12 (9 by maintainers)
Top GitHub Comments
@jorisvandenbossche I agree with you - I don’t think it is up to pandas to provide this. You have already added Styling which is pretty cool.
For me this issue is about whether we should add a CSS config to allow users to provide their own (for objects that don’t have CSS) - I don’t think SG or pandas should provide CSS.
I’ve amended the issue title to just be about pandas dataframes.
If anyone wishes to add CSS for other elements, another issue can be opened.