{"id":13515465,"url":"https://github.com/prettier/plugin-xml","last_synced_at":"2025-05-14T19:09:31.557Z","repository":{"id":36073606,"uuid":"221301638","full_name":"prettier/plugin-xml","owner":"prettier","description":"Prettier XML plugin","archived":false,"fork":false,"pushed_at":"2025-05-07T00:59:46.000Z","size":3306,"stargazers_count":249,"open_issues_count":10,"forks_count":35,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-07T01:42:03.913Z","etag":null,"topics":["prettier","xml"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prettier.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"prettier","open_collective":"prettier","thanks_dev":"u/gh/prettier","tidelift":"npm/prettier"}},"created_at":"2019-11-12T20:04:06.000Z","updated_at":"2025-05-07T00:59:44.000Z","dependencies_parsed_at":"2023-12-14T20:06:29.051Z","dependency_job_id":"7dc802b1-b2e6-4d53-93d7-3b812256cf4b","html_url":"https://github.com/prettier/plugin-xml","commit_stats":{"total_commits":820,"total_committers":17,"mean_commits":48.23529411764706,"dds":"0.28414634146341466","last_synced_commit":"e8b2ca409b18a98507d4810005edb56c0e5fe5e7"},"previous_names":["kddeisz/prettier-plugin-xml"],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prettier%2Fplugin-xml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prettier%2Fplugin-xml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prettier%2Fplugin-xml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prettier%2Fplugin-xml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prettier","download_url":"https://codeload.github.com/prettier/plugin-xml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253365306,"owners_count":21897181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["prettier","xml"],"created_at":"2024-08-01T05:01:11.632Z","updated_at":"2025-05-14T19:09:30.446Z","avatar_url":"https://github.com/prettier.png","language":"JavaScript","funding_links":["https://github.com/sponsors/prettier","https://opencollective.com/prettier","https://thanks.dev/u/gh/prettier","https://tidelift.com/funding/github/npm/prettier"],"categories":["JavaScript","xml"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003ePrettier for XML\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://gitter.im/jlongster/prettier\"\u003e\n    \u003cimg alt=\"Gitter\" src=\"https://img.shields.io/gitter/room/jlongster/prettier.svg?style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/prettier/plugin-xml/actions\"\u003e\n    \u003cimg alt=\"GitHub Actions\" src=\"https://img.shields.io/github/actions/workflow/status/prettier/plugin-xml/main.yml?branch=main\u0026style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@prettier/plugin-xml\"\u003e\n    \u003cimg alt=\"NPM Version\" src=\"https://img.shields.io/npm/v/@prettier/plugin-xml.svg?style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"#badge\"\u003e\n    \u003cimg alt=\"code style: prettier\" src=\"https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://twitter.com/PrettierCode\"\u003e\n    \u003cimg alt=\"Follow+Prettier+on+Twitter\" src=\"https://img.shields.io/twitter/follow/prettiercode.svg?label=follow+prettier\u0026style=flat-square\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n`@prettier/plugin-xml` is a [prettier](https://prettier.io/) plugin for XML. `prettier` is an opinionated code formatter that supports multiple languages and integrates with most editors. The idea is to eliminate discussions of style in code review and allow developers to get back to thinking about code design instead.\n\n## Getting started\n\nTo run `prettier` with the XML plugin, you're going to need [`node`](https://nodejs.org/en/download/).\n\nIf you're using the `npm` CLI, then add the plugin by:\n\n```bash\nnpm install --save-dev prettier @prettier/plugin-xml\n```\n\nOr if you're using `yarn`, then add the plugin by:\n\n```bash\nyarn add --dev prettier @prettier/plugin-xml\n```\n\nThe `prettier` executable is now installed and ready for use:\n\n```bash\n./node_modules/.bin/prettier --plugin=@prettier/plugin-xml --write '**/*.xml'\n```\n\n## Configuration\n\nBelow are the options (from [`src/plugin.js`](src/plugin.js)) that `@prettier/plugin-xml` currently supports:\n\n| API Option                 | CLI Option                     |   Default    | Description                                                                                                              |\n| -------------------------- | ------------------------------ | :----------: | ------------------------------------------------------------------------------------------------------------------------ |\n| `bracketSameLine`          | `--bracket-same-line`          |    `true`    | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#bracket-line))                         |\n| `printWidth`               | `--print-width`                |     `80`     | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#print-width)).                         |\n| `singleAttributePerLine`   | `--single-attribute-per-line`  |   `false`    | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#single-attribute-per-line))            |\n| `tabWidth`                 | `--tab-width`                  |     `2`      | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#tab-width)).                           |\n| `xmlQuoteAttributes`       | `--xml-quote-attributes`       | `\"preserve\"` | Options are `\"preserve\"`, `\"single\"`, and `\"double\"`                                                                     |\n| `xmlSelfClosingSpace`      | `--xml-self-closing-space`     |    `true`    | Adds a space before self-closing tags.                                                                                   |\n| `xmlSortAttributesByKey`   | `--xml-sort-attributes-by-key` |   `false`    | Orders XML attributes by key alphabetically while prioritizing xmlns attributes.                                         |\n| `xmlWhitespaceSensitivity` | `--xml-whitespace-sensitivity` |  `\"strict\"`  | Options are `\"strict\"`, `\"preserve\"`, and `\"ignore\"`. You may want `\"ignore\"` or `\"preserve\"`, [see below](#whitespace). |\n\nAny of these can be added to your existing [prettier configuration\nfile](https://prettier.io/docs/en/configuration.html). For example:\n\n```json\n{\n  \"tabWidth\": 4\n}\n```\n\nOr, they can be passed to `prettier` as arguments:\n\n```bash\nprettier --plugin=@prettier/plugin-xml --tab-width 4 --write '**/*.xml'\n```\n\n### Whitespace\n\nIn XML, by default, all whitespace inside elements has semantic meaning. For prettier to maintain its contract of not changing the semantic meaning of your program, this means the default for `xmlWhitespaceSensitivity` is `\"strict\"`. When running in this mode, prettier's ability to rearrange your markup is somewhat limited, as it has to maintain the exact amount of whitespace that you input within elements.\n\nIf you're sure that the XML files that you're formatting do not require whitespace sensitivity, you can use the `\"ignore\"` option, as this will produce a standardized amount of whitespace. This will fix any indentation issues, and collapse excess blank lines (max of 1 blank line). For most folks most of the time, this is probably the option that you want.\n\nYou can also use the `\"preserve\"` option, if you want to preserve the whitespace of text nodes within XML elements and attributes. See [#478](https://github.com/prettier/plugin-xml/issues/478) for more detail.\n\n### Ignore ranges\n\nYou can use two special comments to get prettier to ignore formatting a specific piece of the document, as in the following example:\n\n```xml\n\u003cfoo\u003e\n  \u003c!-- prettier-ignore-start --\u003e\n    \u003cthis-content-will-not-be-formatted     /\u003e\n  \u003c!-- prettier-ignore-end --\u003e\n\u003c/foo\u003e\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/prettier/plugin-xml.\n\n## License\n\nThe package is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprettier%2Fplugin-xml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprettier%2Fplugin-xml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprettier%2Fplugin-xml/lists"}