Skip to content

Commit 84ee5dc

Browse files
committed
use the exported xfun::html_escape()
1 parent 990dadd commit 84ee5dc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

10-tables.Rmd

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ knitr::kable(d, format = 'latex', escape = TRUE)
165165

166166
Other common special LaTeX characters include `#`, `%`, `&`, `{`, and `}`. Common special HTML characters include `&`, `<`, `>`, and `"`. You need to be cautious when generating tables with `escape = FALSE`, and make sure you are using the special characters in the right way. It is a very common mistake to use `escape = FALSE` and include `%` or `_` in column names or the caption of a LaTeX table without realizing that they are special.
167167

168-
If you are not sure how to properly escape special characters, there are two internal helper functions in **knitr**. Below are some examples:\index{knitr!escape\_latex()}\index{knitr!escape\_html()}
168+
If you are not sure how to properly escape special characters, there are helper functions in **knitr** and **xfun**. Below are some examples:\index{knitr!escape\_latex()}\index{xfun!html\_escape()}
169169

170170
```{r}
171171
knitr:::escape_latex(c('100%', '# a comment', 'column_name'))
172-
knitr:::escape_html(c('<address>', 'x = "character"', 'a & b'))
172+
xfun::html_escape(c('<address>', 'x = "character"', 'a & b'))
173173
```
174174

175175
### Multiple tables side by side

0 commit comments

Comments
 (0)