Pretty Print HTML In Rust
I haven't found a good crate for pretty printing HTML in rust. There are some, but they are all old and have very few downloads. I don't want to sort through that. For now, I'm shelling out to the `tidy`` command line tool like this:
Code
use Write;
use ;
Results
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
Info: Document content looks like HTML5
Tidy found 1 warning and 0 errors!
About HTML Tidy: https://github.com/htacg/tidy-html5
Bug reports and comments: https://github.com/htacg/tidy-html5/issues
Official mailing list: https://lists.w3.org/Archives/Public/public-htacg/
Latest HTML specification: http://dev.w3.org/html5/spec-author-view/
Validate your HTML documents: http://validator.w3.org/nu/
Lobby your company to join the W3C: http://www.w3.org/Consortium
Do you speak a language other than English, or a different variant of
English? Consider helping us to localize HTML Tidy. For details please see
https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md
[_active_nvim_run:19:5] output = Output {
status: ExitStatus(
unix_wait_status(
256,
),
),
stdout: "<!DOCTYPE html>\n<html>\n<head>\n<title>title</title>\n</head>\n<body>\nhere\n</body>\n</html>\n",
stderr: "",
}
The tidy command is designed to clean up HTML documents. That includes altering them to make fixes when it can. For example, it adds a `
I was originally planning to use this to test output from Neopoligen, but that won't work since this can change the code.