GitHub
github.com › prettier › plugin-xml
GitHub - prettier/plugin-xml: Prettier XML plugin · GitHub
Same as in Prettier (see prettier docs). ... Adds a space before self-closing tags. ... Orders XML attributes by key alphabetically while prioritizing xmlns attributes.
Starred by 275 users
Forked by 40 users
Languages JavaScript
Format XML
Please add XML format feature. Reference: #505 Prettier has an official plugin for that: https://github.com/prettier/plugin-xml I wonder, Prettier formats xml but not natively xml? Weird, but ok. I... More on github.com
metadata - How can I get `prettier` to properly format perm set XML files with `flowAccess`? - Salesforce Stack Exchange
Apparently there's another prettier plugin that works with something called "flow." I think it's something to do with the Flow Parser, but am not sure. I do see a parser-flow.mjsn file within the prettier package. Regardless, the tag in the XML seems to be getting messed up by this. More on salesforce.stackexchange.com
How can I prettify/syntax-hilight xml in the browser using prettier?
I am looking at this example that describes how one can format graphql in the browser. e.g. More on stackoverflow.com
unix - How can I pretty print XML content from the command line? - Stack Overflow
Related: How can I pretty-print JSON in a shell script? Is there a (Unix) shell script to format XML content in human-readable form? Basically, I want it to transform the following: <... More on stackoverflow.com
Videos
02:55
How to Prettify & Auto Format XML Documents in VSCode IDE - YouTube
07:10
How to format XML document in Visual Studio Code? - YouTube
01:42
Format document using prettier in vscode | Auto format code - JSON, ...
02:16
How to format XML in Notepad++? || Tutorial for Beginners - YouTube
Prettier
prettier.io
Prettier · Opinionated Code Formatter · Prettier
XML · And more... prettier-js prettier.el Apheleia · espresso-prettier · Prettier Prettier⁺ · JsPrettier · vim-prettier neoformat ALE coc-prettier · JavaScriptPrettier · prettier-vscode · Built-in support · Got more?Send a PR · See others · Regularly used by: More than 83% of respondents to State of JS 2021.
GitHub
github.com › prettier › prettier-vscode › issues › 1579
Format XML · Issue #1579 · prettier/prettier-vscode
September 29, 2020 - I wonder, Prettier formats xml but not natively xml? Weird, but ok. It's slightly different. Anyway, it would be great if the prettier-vscode extension supports formatting xml. The "XML Tools" extension also formats XML. But really ugly. I like the behavior of Prettier for HTML.
Author infacto
Prettier
prettier.io › docs › plugins
Plugins · Prettier
@prettier/plugin-xml · prettier-plugin-apex by @dangmai · prettier-plugin-astro by @withastro contributors · prettier-plugin-bigcommerce-stencil by @phoenix128 · prettier-plugin-elm by @giCentre · prettier-plugin-erb by @adamzapasnik · prettier-plugin-gherkin by @mapado ·
Visual Studio Marketplace
marketplace.visualstudio.com › items
Pretty XML - Visual Studio Marketplace
Extension for Visual Studio Code - XML formatter extension for Visual Studio Code. Formats XML documents just like Visual Studio.
Stack Exchange
salesforce.stackexchange.com › questions › 415949 › how-can-i-get-prettier-to-properly-format-perm-set-xml-files-with-flowaccess
metadata - How can I get `prettier` to properly format perm set XML files with `flowAccess`? - Salesforce Stack Exchange
Adding **/*.xml to .prettierignore does prevent parsing XML files and "fixes" the problem, but we do want XML properly parsed by prettier.
Google Groups
groups.google.com › g › bbedit › c › Uu3d0Q6tnuM
XML Pretty Print
You should have a program called xmllint in your /usr/bin/ directory that can parse and reformat an xml file, stream or URL. Since it can process standard input and output to standard out, it can be used in a text filter. See the user manual and http://bbeditextras.org/wiki/index.php?title...
npm
npmjs.com › package › @prettier › plugin-xml › v › 0.10.0
@prettier/plugin-xml - npm
@prettier/plugin-xml is a prettier plugin for XML. prettier is an opinionated code formatter that supports multiple languages and integrates with most editors.
» npm install @prettier/plugin-xml
Published Jul 08, 2025
Version 0.10.0
Author Kevin Deisz
Repository https://github.com/prettier/plugin-xml
Stack Overflow
stackoverflow.com › questions › 78267751 › how-can-i-prettify-syntax-hilight-xml-in-the-browser-using-prettier
How can I prettify/syntax-hilight xml in the browser using prettier?
<script src="https://unpkg.com/[email protected]/standalone.js"></script> <script src="https://unpkg.com/[email protected]/plugins/graphql.js"></script> <script> (async () => { const formatted = await prettier.format("type Query { hello: String }", { parser: "graphql", plugins: prettierPlugins, }); })(); </script> I am trying to do the same for xml, but from the corresponding cdn page, https://unpkg.com/[email protected]/plugins/ I do not know which plugin I should use.
FreeFormatter
freeformatter.com › xml-formatter.html
Free Online XML Formatter - FreeFormatter.com
This free online XML formatter and lets you chose your indentation level and also lets you export to file
Top answer 1 of 13
1240
xmllint from libxml2
xmllint --format file.xml
(On Debian-based distributions, install the libxml2-utils package.)
xml_pp from the XML::Twig perl module
xml_pp < file.xml
(On Debian-based distributions, install the xml-twig-tools package.)
XMLStarlet
xmlstarlet format --indent-tab file.xml
Tidy
tidy -xml -i -q file.xml
Python's xml.dom.minidom
echo '<root><foo a="b">lorem</foo><bar value="ipsum" /></root>' |
python -c 'import sys, xml.dom.minidom; print(xml.dom.minidom.parseString(sys.stdin.read()).toprettyxml())'
saxon-lint (my own project)
saxon-lint --indent --xpath '/' file.xml
saxon-HE
echo '<root><foo a="b">lorem</foo><bar value="ipsum" /></root>' |
java -cp /usr/share/java/saxon/saxon9he.jar net.sf.saxon.Query \
-s:- -qs:/ '!indent=yes'
xidel
xidel --output-node-format=xml --output-node-indent -se . -s file.xml
(Credit to Reino)
Output for all commands:
<root>
<foo a="b">lorem</foo>
<bar value="ipsum"/>
</root>
2 of 13
195
xmllint --format yourxmlfile.xml
xmllint is a command line XML tool and is included in libxml2 (http://xmlsoft.org/).
================================================
Note: If you don't have libxml2 installed you can install it by doing the following:
CentOS
cd /tmp
wget ftp://xmlsoft.org/libxml2/libxml2-2.8.0.tar.gz
tar xzf libxml2-2.8.0.tar.gz
cd libxml2-2.8.0/
./configure
make
sudo make install
cd
Ubuntu
sudo apt-get install libxml2-utils
Cygwin
apt-cyg install libxml2
macOS
To install this on macOS with Homebrew just do:
brew install libxml2
Git
Also available on Git if you want the code:
git clone git://git.gnome.org/libxml2
npm
npmjs.com › package › xml-formatter
xml-formatter - npm
September 18, 2025 - Converts XML into a human readable format (pretty print) while respecting the xml:space attribute.
» npm install xml-formatter
Published Sep 18, 2025
Version 3.6.7
Author Chris Bottin
Repository https://github.com/chrisbottin/xml-formatter