tidied HTML in vi/vim
If you have Tidy installed, just pipe your buffer through it to get clean HTML.
:%!tidy -qicbn -asxhtml
Use "tidy -h" for more help on the options, but the ones I tend to go with are in the example above:
-indent, -i indent element content
-clean, -c replace FONT, NOBR and CENTER tags by CSS
-bare, -b strip out smart quotes and em dashes, etc.
-numeric, -n output numeric rather than named entities
-quiet, -q suppress nonessential output
-asxml, -asxhtml convert HTML to well formed XHTML
Written by Jason Rogers
Related protips
2 Responses
Thanks @petdance, but Tidy does much more than just fix indentation.
over 1 year ago
·
And beware if you have SVG embedded.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#