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

Overflowing content of table cells get placed in the wrong column on the next page #299

Open
ulyngs opened this issue Sep 30, 2022 · 9 comments

Comments

@ulyngs
Copy link

ulyngs commented Sep 30, 2022

I'm running into this problem in my R Markdown template for making academic CVs with pagedown, and I can't figure out what's causing it or how to solve it. Here's a minimal reproducible example:

Create an R Markdown file with this content:

---
output: pagedown::html_paged
---

```{r, echo=FALSE, message=FALSE}
library(dplyr)

tibble(
  id = 1:100,
  content = "here's a line<br>and here's another line"
) |> 
  knitr::kable()
```

When a page break divides up the content in second-column cells, then the remaining cell content is erroneously placed in the first column instead of in the second column:

image

Any idea about how to fix this?

@ulyngs ulyngs changed the title Table cell content with line breaks get placed in the wrong row if there's a page break Table cells that contain line breaks get confused by page breaks (content end up in the wrong column on the next page) Oct 1, 2022
@ulyngs ulyngs changed the title Table cells that contain line breaks get confused by page breaks (content end up in the wrong column on the next page) Table cells with line breaks get confused by page breaks (content put in the wrong column on next page) Oct 1, 2022
@ulyngs ulyngs changed the title Table cells with line breaks get confused by page breaks (content put in the wrong column on next page) Overflowing content of table cells get placed in the wrong column on the next page Oct 1, 2022
@ulyngs
Copy link
Author

ulyngs commented Oct 1, 2022

Hmmm it seems it's actually not about the break tags, I get the same problem with regular content that overflows between pages:

image

---
output: pagedown::html_paged
---

```{r, echo=FALSE, message=FALSE}
library(dplyr)

tibble(
  id = 1:100,
  content = "here's a line and here's another line and another one and some more amazing content and yet more and more and more"
) |> 
  knitr::kable()
```

@xvazquezc
Copy link

Same issue here. Any word from the devs?

@courtney-bryce-hilton
Copy link

courtney-bryce-hilton commented Nov 20, 2022

+1 am having the same issue, and I can confirm that it is not specific to break tags. At least in my case, it happens whenever a row has to be split across pages. I have this problem and can reproduce the above example with 0.19 pagedown (and have also tried older versions to the same effect).

@courtney-bryce-hilton
Copy link

For anybody needing a temporary hacky solution, I got it working for me by manually creating additional tables to ensure they never cross a page.

@ulyngs
Copy link
Author

ulyngs commented Nov 21, 2022

The workaround I use is to manually add a page break at the end of the content in the last cell that fits on a page. I do this by linking a style sheet with a style like this:

styles.css

br.pageBreak { page-break-after: always; }

Then I insert a page break by ending <br class="pageBreak"> at the end of content in the cell that's the last one to fit on the page.

In pagedownCV I added a convenience function to insert this, but it still has to be applied manually -- I don't know a way to automatically detect whether a table will be broken apart

@ulyngs
Copy link
Author

ulyngs commented Nov 21, 2022

@cderv any chance you know some magical way we might go around fixing this? :)

@cderv
Copy link
Collaborator

cderv commented Nov 21, 2022

No I don't have a magical way sorry. First thing would need to check somehow if the error is still present with newer version of paged.js.

Unfortunately, I can't spend much time on that, but happy to review any PR is anyone found how to fix that, even a temporary workaround to add. We'll then merge and do a release with pleasure.

Sorry for the inconvenience currently.

@ethanhurwitz
Copy link

+1, issue is still occurring.

@meefen
Copy link

meefen commented Jan 11, 2023

+1. Is there a fix?

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