I have some HTML code, which I generate using x-expressions: (string-append DOCTYPE-HTML5 "\n" (xexpr->string `(html (body ((bgcolor "red")) "Hi!" (br) "Bye!"))))
I don't like how the result looks in the source code of the web page created in this way. I'd like there to be indentation and line breaks, according to the nesting of the DOM elements. So far I've found the following links and information: - https://docs.racket-lang.org/reference/pretty-print.html (I don't know how to use it, because it has no examples. It also seems more like a library, which generically can pretty print anything you want, provided you "configure" is correctly. However, HTML is quite complex, I think, so I'd not like to rewrite something that already exists elsewhere.) - https://docs.racket-lang.org/xml/ (Here are some mentions of indentation and newlines, but I need some procedure, which returns it, not displays it immediately and then "does not let me have it", or is there a way to somehow redirect output into a value which I can use? For example `display-xml` seems to do what I need. :) Ideal might be a keyword parameter for `xexpr->string`, which specifies whether it should prettify the string or not, but such a thing does not exist according to the docs. How can I prettify my HTML output? (I really don't care about a few bytes more data needing to be sent. This is not the next Google.) -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.