I'd like to do exactly what xml2::xml_text() or rvest::html_text() do but preserve the tags instead of replacing e.g. <br> with \n. The objective is to e.g. scrape a web page, extract the nodes I want, and store the plain HTML in a variable, much like write_html() would store it in a file.
How can I do this?