You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we use kable(tbl, format = "pipe") and our table has one or more hyperlinks, written as [label](my-url), the width of the column will be based on nchar("[label](my-url)") rather than on nchar("label"). I've noticed this can be problematic when my-url is extremely long. Here's an example:
very_long_url<- paste(c("a", rep("very", 20), "long-url"), collapse="-")
tbl<-data.frame(
flavor= sprintf("[Mint chip](%s)", very_long_url),
description="Of all the many flavors of ice cream, this is my favorite."
)
knitr::kable(tbl, format="pipe")
| flavor | description |
|:----------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------|
| [Mint chip](a-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-very-long-url) | Of all the many flavors of ice cream, this is my favorite. |
The problem is that when one uses rmarkdown::render() on a Markdown file with such a table, the resulting html squeezes the second column unnecessarily:
To reproduce the screenshot, one can download example.zip, which has example.Rmd in it, and then run the following two lines:
I have provided the necessary information about my issue.
If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('knitr'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('yihui/knitr').
If I have posted the same issue elsewhere, I have also mentioned it in this issue.
I have learned the Github Markdown syntax, and formatted my issue correctly.
I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered:
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.
When we use
kable(tbl, format = "pipe")
and our table has one or more hyperlinks, written as[label](my-url)
, the width of the column will be based onnchar("[label](my-url)")
rather than onnchar("label")
. I've noticed this can be problematic whenmy-url
is extremely long. Here's an example:The problem is that when one uses
rmarkdown::render()
on a Markdown file with such a table, the resulting html squeezes the second column unnecessarily:To reproduce the screenshot, one can download example.zip, which has
example.Rmd
in it, and then run the following two lines:By filing an issue to this repo, I promise that
xfun::session_info('knitr')
. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('yihui/knitr')
.I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered: