Add xml-pretty-print
This commit is contained in:
parent
b29c541f33
commit
d98ce82424
@ -4,6 +4,17 @@
|
||||
:straight (:type built-in)
|
||||
:defer t
|
||||
:config
|
||||
(defun xml-pretty-print ()
|
||||
(interactive)
|
||||
(let ((start (if (region-active-p) (region-beginning) (point-min)))
|
||||
(end (if (region-active-p) (region-end) (point-max))))
|
||||
(cond
|
||||
((executable-find "tidy")
|
||||
(shell-command-on-region start end "tidy -wrap 88 -q -i -xml" nil t))
|
||||
((executable-find "xmllint")
|
||||
(shell-command-on-region start end "xmllint --format -" nil t))
|
||||
(t (sgml-pretty-print start end)))))
|
||||
(general-def nxml-mode-map "C-M-\\" #'xml-pretty-print)
|
||||
(add-to-list 'hs-special-modes-alist
|
||||
'(nxml-mode
|
||||
"<!--\\|<[^/>]*[^/]>" ;; regexp for start block
|
||||
|
Loading…
Reference in New Issue
Block a user