Babashka Snippet to tidy html (adapted from Chatgpt)
(import '[org.jsoup Jsoup])
(defn tidy-html [path]
(let [doc (Jsoup/parse (slurp path))]
(spit path (.html doc))))
I'm sharing it because the original suggestion was not workingOriginal suggestion was below, but the https://jsoup.org/apidocs/org/jsoup/nodes/Document.OutputSettings is not part of Babashka and I am not sure if it is needed since the above works to tidy.
(import '[org.jsoup Jsoup])
(defn tidy-html [path]
(let [doc (Jsoup/parse (slurp path))
settings (.outputSettings doc)]
(.prettyPrint settings true)
(.indentAmount settings 2)
(.outline settings true)
(spit path (.html doc))))Thank you!
It is nice because it saves me from installing random other tools!