Skip to content
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

browsable html lost dependency in print #125

Closed
haozhu233 opened this issue Apr 19, 2019 · 2 comments
Closed

browsable html lost dependency in print #125

haozhu233 opened this issue Apr 19, 2019 · 2 comments

Comments

@haozhu233
Copy link
Contributor

Hi, I noticed that print.html calls HTML again in function. This call removes all the HTML dependencies on the original object.

htmltools/R/tags.R

Lines 223 to 229 in 4b34e98

print.html <- function(x, ..., browse = is.browsable(x)) {
if (browse)
html_print(HTML(x))
else
cat(x, "\n", sep = "")
invisible(x)
}

Here is an example.

aaa <- HTML(as.character(shiny::icon("times")))
htmlDependencies(aaa) <- rmarkdown::html_dependency_font_awesome()
browsable(aaa) # which won't print the FA icon

html_print(aaa) # which will print the icon
@haozhu233
Copy link
Contributor Author

I'm also willing to submit a PR but I hope someone could let me know whether it would be better to remove this HTML call (cuz this is the print function for the html class already), or you think it would be better to keep it and have some extra step to preserve the html dependency attributes.

@jcheng5
Copy link
Member

jcheng5 commented Apr 20, 2019

Thanks for the report. I can't think of why we need the HTML() call.

haozhu233 added a commit to haozhu233/htmltools that referenced this issue Apr 22, 2019
@wch wch closed this as completed in cb452a8 Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants