hughjonesd / huxtable

An R package to create styled tables in multiple output formats, with a friendly, modern interface.
http://hughjonesd.github.io/huxtable
Other
321 stars 28 forks source link

Unable to use HTML entities in cell, even with escaping turned off #12

Closed atyre2 closed 7 years ago

atyre2 commented 7 years ago

Awesome package, thank you!

library(huxtable)
ht <- hux(
  Statistic     = c('&chi;<sup>2</sup>'), 
  add_colnames = TRUE
)
print_html(ht)
escape_contents(ht)[1,1]
escape_contents(ht)[1,1] <- FALSE
print_html(ht)

Doesn't seem to matter what I do I end up with

&amp;chi;&lt;sup&gt;2&lt;/sup&gt;

in the table cell.

When I edit the html file manually it works as expected. I'm using 0.3.0 with R 3.4.0.

atyre2 commented 7 years ago

OMG FACEPALM.

escape_contents(ht)[2,1] <- FALSE

b/c the top row is the header -- this has caught me off guard a couple times ...