Factor out html_dependencies_as_character

I think this is a little cleaner, and easier to use from other places.  I'm fairly certainly I have the logic in `copy_deps()` correct, but recursive copying in R is a bit of a nightmare.