lang/web: more sensible html-tidy formatter config

+ No longer inserts html/body tags unless they're detected in the buffer
+ Respect tab-width and indent-tab-mode
+ Don't auto-remove empty elements
This commit is contained in:
Henrik Lissner 2018-09-03 03:59:24 +02:00
parent df42d8ce89
commit b697ad982e
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -17,6 +17,18 @@
:config :config
(set-docsets! 'web-mode "HTML" "Twig" "WordPress") (set-docsets! 'web-mode "HTML" "Twig" "WordPress")
;; tidy is already defined by the format-all package. We redefine it to add
;; more sensible arguments to the tidy command.
(set-formatter! 'html-tidy
'("tidy" "-q" "-indent"
"--tidy-mark" "no"
"--drop-empty-elements" "no"
"--show-body-only" "auto"
("--indent-spaces" "%d" tab-width)
("--indent-with-tabs" "%s" (if indent-tabs-mode "yes" "no"))
("-xml" (memq major-mode '(nxml-mode xml-mode))))
:ok-statuses '(0 1))
(setq web-mode-enable-html-entities-fontification t (setq web-mode-enable-html-entities-fontification t
web-mode-auto-close-style 2) web-mode-auto-close-style 2)