mknotebooks icon indicating copy to clipboard operation
mknotebooks copied to clipboard

Pandas tables not wrapping properly

Open vtoliveira opened this issue 4 years ago • 9 comments

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.

vtoliveira avatar Mar 27 '20 14:03 vtoliveira

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;
  }

LeonardAukea avatar Oct 29 '20 04:10 LeonardAukea

Thanks @LeonardAukea, this helped me out.

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

timvink avatar Apr 06 '21 12:04 timvink

Sounds like it - pr very welcome 🙂

greenape avatar Apr 06 '21 12:04 greenape

I'll provide the PR tomorrow.

LeonardAukea avatar Apr 07 '21 16:04 LeonardAukea

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.

timvink avatar Apr 07 '21 19:04 timvink

@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 :)

LeonardAukea avatar Apr 07 '21 19:04 LeonardAukea

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;
  }

Harsh-Maheshwari avatar Sep 04 '22 13:09 Harsh-Maheshwari

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

timvink avatar Sep 04 '22 18:09 timvink

@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.

nathnx avatar Oct 17 '22 06:10 nathnx