Open martijndeb opened 5 years ago
@sexybiggetje I'm up against this too, but it seems to be a limitation of Weasyprint and not this plugin.
https://github.com/Kozea/WeasyPrint/issues/36
That issue is 6 years old 😞
I managed to split such table into multiple pages with the attached modification to themes/material.py in Material theme doc.
Yes, it's a quite dirty hack, but worked. I tried to find out appropriate style rule to make it work without "!important", but couldn't.
Oops, I made a mistake in the path of the previous patch, please adjust accordingly. Also, the table's width becomes 100% as a side-effect, and it might be better to remove border settings to conceal this. Anyway, I'd like to wait for CSS guru to provide much better solutions.
@akinmr Oh nice workaround! I've tested and confirmed that this works.
You don't have to patch anything, just include a custom CSS file (or modify your existing one), and include this in the @media print block like so:
mkdocs.yml
extra_css:
- 'stylesheets/pdf.css' # for example, this would be the path to your stylesheet
pdf.css
@media print {
.md-typeset table:not([class]) {
display: block;
border: none;
}
}
The increased specificity (table:not([class])
) is required to override the theme stylesheet and negates the need for !important. I'm also removing the table border to sidestep the weird 100% width table box effect.
This workaround will only work for material design themes, but you could make it work with any theme by adapting the CSS selector.
Probably could be refined further, particularly if the outside border is important, but this is an easy and acceptable workaround for my purposes.
Thanks for figuring that out!
Say you have a chapter called "Chapter about Tables", and you generate a table in it that's longer than the page. The table gets pushed to a new page, causing "Chapter about Tables" to be on it's own page with a lot of whitespace.
The table if longer than a page should continue on a new page, instead it's cut off at the bottom part of the page.
(Rename long-table.txt to .md) long-table.txt