Open kevinushey opened 2 months ago
By analogy with JSON, I'm interested in taking something like this:
{"user":{"id":1,"name":"John Doe","contact":{"email":"john.doe@example.com","phone":{"home":"555-555-5555","work":"555-555-5556"}},"address":{"street":"123 Main St","city":"Anytown","state":"CA","postalCode":"12345","coordinates":{"latitude":37.7749,"longitude":-122.4194}},"preferences":{"notifications":{"email":true,"sms":false},"theme":"dark"}}}
and prettifying it like this:
json |> jsonlite::prettify()
#> {
#> "user": {
#> "id": 1,
#> "name": "John Doe",
#> "contact": {
#> "email": "john.doe@example.com",
#> "phone": {
#> "home": "555-555-5555",
#> "work": "555-555-5556"
#> }
#> },
#> "address": {
#> "street": "123 Main St",
#> "city": "Anytown",
#> "state": "CA",
#> "postalCode": "12345",
#> "coordinates": {
#> "latitude": 37.7749,
#> "longitude": -122.4194
#> }
#> },
#> "preferences": {
#> "notifications": {
#> "email": true,
#> "sms": false
#> },
#> "theme": "dark"
#> }
#> }
#> }
#>
But with HTML.
libxml2
supports indentation of generated XML / HTML documents, via https://github.com/GNOME/libxml2/blob/master/xmlwriter.c#L4570-L4589. It would be handy if this could be made available inwrite_xml()
andwrite_html()
.