-
Notifications
You must be signed in to change notification settings - Fork 28
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
A way to remove all theme and css style of tables #241
Comments
Hmm, seems reasonable. I'll look into it. |
A workaround right now might be to capture the HTML with to_html and then edit it with tools from another package. |
Maybe an argument to |
Hmm. Let me check. Do you really mean all the CSS - heights, colours, everything? If so, that will remove most of the functionality. So then I think the best thing would be a new function |
|
So, I think the best way to do this is with xml2. Here is an example: library(huxtable)
library(xml2)
jams
jams_tbl <- jams |>
huxtable::as_html() |>
read_html() |>
xml_find_first("./table")
xml_set_attr(jams_tbl, "class", "myclass") # modification in place, unusual for R
tds <- xml_find_all(jams_tbl, ".//td")
xml_set_attr(tds, "style", "") # remove all styles
as.character(jams_tbl) I'm still open to doing this if there is demand. There may also be better HTML manipulation libraries that I don't know about. |
I am currently using huxtable for displaying some table and it is working good.
But I found that the css style is always added to huxtable object even when I use theme_basic(). Although the themes in huxtable are nice, I prefer my own ones.
Thus, I would like to know if there is a way to remove the buildin themes and css style. The raw HTML code is probably what I need.
The text was updated successfully, but these errors were encountered: