-
Notifications
You must be signed in to change notification settings - Fork 213
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
Make <br>
a universal linebreak across formats
#1767
Comments
If possible, would it makes sense to make |
I second the suggestion to make |
I think my main reasoning is that even if gt supports all formats, it still remains an html-first format. When I construct a complex gt table, I do it interactively in html, and hope for the best when trying to convert to other formats. I am doing so blindly (too much sometimes).
So getting a LaTeX output or grid or docx is a matter of converting the html to this other format as close as possible to the html output. Similarly, ggplot2 is grid first. Therefore, to make it interactive, By default, html ignores line breaks and multiple consecutive spaces. # no line break
data.frame(
x = c("x\ny")
) |>
gt() data.frame(x = c("x\ny") |>
gt() |>
gt::opt_interactive() grid is my new second favorite for easy previewing! # line break
data.frame(x = c("x\ny") |>
gt() |>
as_gtable() |>
plot() Unfortunately, the output is not the same, hence a surprise output in my opinion. We have to have one source of truth for this to be effective. There are also a lot of contexts where In md Text
on the same line In R, cli::cli_abort("x\ny")
#> Error:
#> ! x y In gt, by default. data.frame(
x = c("x\ny")
) |>
gt() Changing \n as a linebreak in html would be a breaking change. I could live with it, but I think it would feel surprising for many JS / md /css / pandoc experts. @rich-iannone feel free to add your grain of salt here! One of my first use cases for There is also the danger of helpers like Edit: my assessment may have been incorrect. |
Yeah, it might be a bit eccentric but I think |
I think one thing to make "just work" is recognizing
<br>
as a line break in all output contexts; this'll avoid any need to callfmt_markdown()
. This could probably be done in theprocess_text()
function.We incidentally also need a similar bit of 'extra' markup to represent cross-output tab stops but that's for another issue.
Originally posted by @rich-iannone in #1765 (comment)
As of gt 0.11
just shows as
)
works for md/html
shows as
and \n acts like a space)
For rtf
the
text_grob
argument ofas_gtable()
can be used.#1776 (comment)
The text was updated successfully, but these errors were encountered: