David Schwartz 426 Posted August 16, 2019 This site https://htmlformatter.com/ does an awesome job of taking a huge glom of unformatted HTML and pretty-printing it so it's super-readable. Are there any components that can do that in Delphi? You'd give it a string or stringstream, and it formats it into another string or stringstream or TStringList (eg., a TMemo) All I can find in Google is how to format Delphi (pascal) code. Share this post Link to post
Kryvich 165 Posted August 16, 2019 I think most of these online formatters use HTML Tidy internally. Share this post Link to post
Lars Fosdal 1792 Posted August 16, 2019 What about the https://www.delphihtmlcomponents.com/ from @Alexander Sviridenkov ? I don't use them, but I've seen them getting a lot of praise. Share this post Link to post
Alexander Sviridenkov 356 Posted August 16, 2019 Currently library supports formatting only for XML or XHTML. HTML formatter is expected in next version. 2 Share this post Link to post
aehimself 396 Posted August 29, 2019 Do you need parsing too, or only to beautify the code? I wrote a unit which beautifies and simplifies (remove idents and formatting to reduce size) XML documents and it's using only string helper functions. It formats a ~14 MB XML file in about 300ms, however this heavily depends on the amount of tags. Since the structure is very close I suppose it can work with HTML. If you don't want to use components / libraries let me know, I can send you the code. Share this post Link to post
David Schwartz 426 Posted September 3, 2019 Thanks, but my time is exhausted on this. It wasn't worth the trouble to automate ... faster to just eyeball the results. Share this post Link to post