mirror of
https://github.com/vale981/apheleia
synced 2025-03-05 09:31:40 -05:00
Add html-tidy formatter (#173)
This commit is contained in:
parent
568862dc84
commit
2686e7b17d
5 changed files with 39 additions and 0 deletions
|
@ -28,12 +28,14 @@ The format is based on [Keep a Changelog].
|
||||||
for [Bazel Build](https://bazel.build/) ([#171]).
|
for [Bazel Build](https://bazel.build/) ([#171]).
|
||||||
* [`cmake-format`](https://github.com/cheshirekow/cmake_format)
|
* [`cmake-format`](https://github.com/cheshirekow/cmake_format)
|
||||||
for [CMake](https://cmake.org/) ([#172]).
|
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
|
[#168]: https://github.com/radian-software/apheleia/pull/168
|
||||||
[#169]: https://github.com/radian-software/apheleia/pull/169
|
[#169]: https://github.com/radian-software/apheleia/pull/169
|
||||||
[#170]: https://github.com/radian-software/apheleia/pull/170
|
[#170]: https://github.com/radian-software/apheleia/pull/170
|
||||||
[#171]: https://github.com/radian-software/apheleia/pull/171
|
[#171]: https://github.com/radian-software/apheleia/pull/171
|
||||||
[#172]: https://github.com/radian-software/apheleia/pull/172
|
[#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
|
[#174]: https://github.com/radian-software/apheleia/pull/174
|
||||||
[#182]: https://github.com/radian-software/apheleia/pull/182
|
[#182]: https://github.com/radian-software/apheleia/pull/182
|
||||||
[#187]: https://github.com/radian-software/apheleia/pull/187
|
[#187]: https://github.com/radian-software/apheleia/pull/187
|
||||||
|
|
16
apheleia.el
16
apheleia.el
|
@ -62,6 +62,22 @@
|
||||||
(gofumpt . ("gofumpt"))
|
(gofumpt . ("gofumpt"))
|
||||||
(goimports . ("goimports"))
|
(goimports . ("goimports"))
|
||||||
(google-java-format . ("google-java-format" "-"))
|
(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" "-"))
|
(isort . ("isort" "-"))
|
||||||
(jq "jq" "."
|
(jq "jq" "."
|
||||||
(apheleia-formatters-js-indent "--tab" "--indent"))
|
(apheleia-formatters-js-indent "--tab" "--indent"))
|
||||||
|
|
1
test/formatters/installers/html-tidy.bash
Normal file
1
test/formatters/installers/html-tidy.bash
Normal file
|
@ -0,0 +1 @@
|
||||||
|
apt-get install -y tidy
|
1
test/formatters/samplecode/html-tidy/in.html
Normal file
1
test/formatters/samplecode/html-tidy/in.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<!DOCTYPE html><html lang="en"><head><title>Hello world</title></head><body><ul><li>1</li><li>2</li><li><ul><li>3</li></ul></li></ul></body></html>
|
19
test/formatters/samplecode/html-tidy/out.html
Normal file
19
test/formatters/samplecode/html-tidy/out.html
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Hello world</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<ul>
|
||||||
|
<li>1</li>
|
||||||
|
|
||||||
|
<li>2</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<ul>
|
||||||
|
<li>3</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Add table
Reference in a new issue