diff --git a/CHANGELOG.md b/CHANGELOG.md index fbe06814..c19a9788 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,12 +28,14 @@ The format is based on [Keep a Changelog]. for [Bazel Build](https://bazel.build/) ([#171]). * [`cmake-format`](https://github.com/cheshirekow/cmake_format) for [CMake](https://cmake.org/) ([#172]). +* [`html-tidy`](https://www.html-tidy.org/) for HTML/XML ([#173]). [#168]: https://github.com/radian-software/apheleia/pull/168 [#169]: https://github.com/radian-software/apheleia/pull/169 [#170]: https://github.com/radian-software/apheleia/pull/170 [#171]: https://github.com/radian-software/apheleia/pull/171 [#172]: https://github.com/radian-software/apheleia/pull/172 +[#173]: https://github.com/radian-software/apheleia/pull/173 [#174]: https://github.com/radian-software/apheleia/pull/174 [#182]: https://github.com/radian-software/apheleia/pull/182 [#187]: https://github.com/radian-software/apheleia/pull/187 diff --git a/apheleia.el b/apheleia.el index 5ca83516..40f8a183 100644 --- a/apheleia.el +++ b/apheleia.el @@ -62,6 +62,22 @@ (gofumpt . ("gofumpt")) (goimports . ("goimports")) (google-java-format . ("google-java-format" "-")) + (html-tidy "tidy" + "--quiet" "yes" + "--tidy-mark" "no" + "--vertical-space" "yes" + "-indent" + (when (derived-mode-p 'nxml-mode) + "-xml") + (apheleia-formatters-indent + "--indent-with-tabs" + "--indent-spaces" + (cond + ((derived-mode-p 'nxml-mode) + 'nxml-child-indent) + ((derived-mode-p 'web-mode) + 'web-mode-indent-style))) + (apheleia-formatters-fill-column "-wrap")) (isort . ("isort" "-")) (jq "jq" "." (apheleia-formatters-js-indent "--tab" "--indent")) diff --git a/test/formatters/installers/html-tidy.bash b/test/formatters/installers/html-tidy.bash new file mode 100644 index 00000000..d3846250 --- /dev/null +++ b/test/formatters/installers/html-tidy.bash @@ -0,0 +1 @@ +apt-get install -y tidy diff --git a/test/formatters/samplecode/html-tidy/in.html b/test/formatters/samplecode/html-tidy/in.html new file mode 100644 index 00000000..3cbbf29d --- /dev/null +++ b/test/formatters/samplecode/html-tidy/in.html @@ -0,0 +1 @@ +Hello world diff --git a/test/formatters/samplecode/html-tidy/out.html b/test/formatters/samplecode/html-tidy/out.html new file mode 100644 index 00000000..59b2a4b9 --- /dev/null +++ b/test/formatters/samplecode/html-tidy/out.html @@ -0,0 +1,19 @@ + + + + Hello world + + + + +