-
Notifications
You must be signed in to change notification settings - Fork 65
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
Let "grid"-styled pandoc.table
s accept empty lines in cells
#357
Comments
Hm, I'm not exactly sure top of my head why is it working that way and if it was intentional .. but I wonder if using a hard linebreak with backslash might be a good enough workaround? sample_df <- data.frame(
case = c(
"A very large text line that will be split into two lines within a cell",
"Short text"
),
lines = c("multiple lines\n\\\nwith line breaks", "more\n\nline breaks"))
sample_df |> pandoc.table(
style = "grid",
justify = "ll",
split.tables = Inf,
keep.line.breaks = TRUE
) Resulting in
|
That's a nice workaround indeed! It's funny that it doesn't actually separate the lines in two paragraphs, but nevertheless, it inserts a "line break" which works just as well. And by the way, it works just as fine without the first "newline" character, i.e.: sample_df <- data.frame(
case = c(
"A very large text line that will be split into two lines within a cell",
"Short text"
),
lines = c("multiple lines\\\nwith line breaks", "more\n\nline breaks")) There is just a slight difference in the line spacing when rendering to HTML, as you can see here: But for me it would do anyway. I'm not sure if the maintainers would actually want to check out the "newline" thing anyway, so I'll leave the issue open, just in case. |
For the record, why and when this happens seems rather difficult to track down. I lose track in the call to |
In the following example
Created on 2022-04-19 by the reprex package (v2.0.1)
Session info
It can be seen that
pander.table
strips off extra newlines in between a character value. Thus it gives the following result:Where I would like to have the following:
Would it be possible to have it work like that, or have an additional parameters that allows to turn on/off the extra-newline stripping?
The text was updated successfully, but these errors were encountered: