Skip to content
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

Pandas tables not wrapping properly #24

Open
vtoliveira opened this issue Mar 27, 2020 · 9 comments
Open

Pandas tables not wrapping properly #24

vtoliveira opened this issue Mar 27, 2020 · 9 comments

Comments

@vtoliveira
Copy link

This is one of my first issues, I hope I am doing it right.

I tried to use mknotebooks to render a notebook, but all my pandas tables with a few extra columns are not wrapped properly. This is a print of screen:

image

I am not sure it this is a bug, or something that I am doing wrong, so I will label it as a question.

@LeonardAukea
Copy link

Adding this to css helps:

table {
    display: block;
    max-width: -moz-fit-content;
    max-width: fit-content;
    margin: 0 auto;
    overflow-x: auto;
    white-space: nowrap;
  }

@timvink
Copy link
Contributor

timvink commented Apr 6, 2021

Thanks @LeonardAukea, this helped me out.

@greenape Should this CSS be included with mknotebooks by default? would you like a PR?

@greenape
Copy link
Owner

greenape commented Apr 6, 2021

Sounds like it - pr very welcome 🙂

@LeonardAukea
Copy link

I'll provide the PR tomorrow.

@timvink
Copy link
Contributor

timvink commented Apr 7, 2021

Oh I meant to offer a PR, but bit pressed for time so it was on my backlog. Thanks @LeonardAukea :)

Might be to good to add an extra selector to the CSS so it only applies to ipynb pages, so there are no side-effects with other plugins. Also possible is to provide the PR with max-width to mkdocs-material -- solving the issue as the source.

@LeonardAukea
Copy link

LeonardAukea commented Apr 7, 2021

@timvink feel free to do it if you want 😄. I'm a bit busy anyways.

I would love for this plugin to be functional with interactive plots :)

@Harsh-Maheshwari
Copy link

This issue still seems to be in play. Where and what do i need to add for dataframes to be displayed better

table {
    display: block;
    max-width: -moz-fit-content;
    max-width: fit-content;
    margin: 0 auto;
    overflow-x: auto;
    white-space: nowrap;
  }

@timvink
Copy link
Contributor

timvink commented Sep 4, 2022

This is CSS (cascading style sheets), put it in a file with a .css extension and add it to your theme from your mkdocs.yml file using the extra_css config options: https://www.mkdocs.org/user-guide/configuration/#extra_css

@nathnx
Copy link

nathnx commented Oct 17, 2022

@Harsh-Maheshwari I've copied pandas-data frame.css to my project as an extra css file and added the table class to the it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants