{"name":"xml-formatter","version":"2.3.1","repository":{"type":"git","url":"git+https://github.com/chrisbottin/xml-formatter.git"},"bugs":{"url":"https://github.com/chrisbottin/xml-formatter/issues"},"homepage":"https://github.com/chrisbottin/xml-formatter#readme","description":"Converts a XML string into a human readable format (pretty print) while respecting the xml:space attribute","author":{"name":"Chris Bottin","email":"chrisbottin@gmail.com"},"license":"MIT","main":"index.js","scripts":{"test":"mocha","prepublishOnly":"eslint . && npm test && npm run dist:prepare && npm run dist:build","dist:prepare":"rm -rf ./dist && mkdir -p ./dist/browser","dist:build":"browserify -r ./index.js:xml-formatter -o ./dist/browser/xml-formatter.js"},"engines":{"node":">= 10"},"keywords":["xml","pretty","print","pretty-print","indent","parser","formatter","xml:space","preserve"],"dependencies":{"xml-parser-xo":"^3.1.1"},"devDependencies":{"browserify":"^13.1.1","chai":"^4.2.0","eslint":"^6.8.0","glob":"^7.1.6","mocha":"^6.2.1"},"gitHead":"6ea9973bd9e972fcff0c46820f20c846f25116f9","_id":"xml-formatter@2.3.1","_nodeVersion":"12.10.0","_npmVersion":"6.10.3","_npmUser":{"name":"chrisbottin","email":"chrisbottin@gmail.com"},"dist":{"integrity":"sha512-jvqmM7aowtzgi05LfvWjXLqajeRNu50/dX6Q26a4jwdpMwuCz6FRYRkvqvPBThe7bordClp35jiR/zxRrtM0NQ==","shasum":"79201637dad4fe4b2e58fbd6bf1524ac830ea505","tarball":"http://registry-npm.ywwl.com/xml-formatter/download/xml-formatter-2.3.1.tgz","fileCount":6,"unpackedSize":21665,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfjcmFCRA9TVsSAnZWagAAWd4P/0gmFmk6ll0+GVb7d6rh\nJ5JGilYMXCPg/ZKQRsZy8ftt/NneIAEf6/a4HhTYQzjLBGI7qUhrPJ/mnFYq\nvMq8TXGkVnuGASB8Doc0A3nrRjzfAIQVoLidAgSO7v1lXGjhIlTIvE/EI1uW\nRMmrhyeIBtau5mhVgDx1AvPrN5WbkW0n+/OtL2NIzo5f9zBUSY/SfTJHND3M\n0uiDxAxnX1HoZm41cEE8YFFRaM82Dyf9+4DD8ehscDvxDDyPdNBEWMlkW2/V\n+tV4EJWLK7RABpDIZP00czjKKr4oP0GiQTYKdY7mVu22UlSW530rsA2PP0ed\nOidUqpLqGAT2scQcwK0uowQ89SCFVCulIDrhHmneaG60HR8FIsNbC7SS3x4N\nd8EaA+KXdVvy5YCIGfKl31Ilhdn+inOllP+J2ckUc/MDMDIbD60PMW63wtQe\nhz89tybl+UlAqp4DlKIPZhH2xXuMAZfFS3+NkgpzBXF4OafgRfFmdaSu9m0d\ntDWTpPyXpX5ioyuvWLYK5dH0Jy02VTNU+laNBCaO8olVjH3nCi6pR0Ffkzn2\nKY1V7r3zqgKEjY8jL7tuOPaD4Wt5PRpFkNd4lm/Fq60aDX45LexDg3oxCGLX\n4BNxU/WnrOEQYQ60RcxaokCtVpOwSyN35J4GEWH0GNgaqpwB3WObJumX8O1A\nTlpC\r\n=mqXw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD6fVXS2Xk+tujYD2fkQwXYqTwTvKSERNLPQ1nYisKu5AIhAJQvJ+VtUBJUaYme2Lo8v0l9ArAQotOo3I0jes9o1vLP"}],"size":4967,"noattachment":false,"key":"/xml-formatter/-/xml-formatter-2.3.1.tgz"},"maintainers":[{"name":"chrisbottin","email":"chrisbottin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/xml-formatter_2.3.1_1603127684855_0.34833068836680936"},"_hasShrinkwrap":false,"readme":"\n# xml-formatter\n\nConverts XML into a human readable format (pretty print) while respecting the `xml:space` attribute.\n\nReciprocally, the `xml-formatter` package can minify pretty printed XML.\n\nThe `xml-formatter` package can also be used on the browser using the browserified version with a small footprint.\n\n[![Build Status](https://github.com/chrisbottin/xml-formatter/actions/workflows/ci.yml/badge.svg)](https://github.com/chrisbottin/xml-formatter/actions/workflows/ci.yml) [![npm version](https://img.shields.io/npm/v/xml-formatter.svg)](https://npmjs.org/package/xml-formatter)\n\n## Installation\n\n```\n$ npm install xml-formatter\n```\n\n## Example\n\n### Usage:\n\n```js\nimport xmlFormat from 'xml-formatter';\n\nxmlFormat('<root><content><p xml:space=\"preserve\">This is <b>some</b> content.</content></p>');\n```\n\n### Output:\n\n```xml\n<root>\n    <content>\n        <p xml:space=\"preserve\">This is <b>some</b> content.</p>\n    </content>\n</root>\n```\n\n## Options\n\n- `filter`: Function to filter out unwanted nodes by returning `false`.\n  - type: `function(node) => boolean`\n  - default: `() => true`\n- `ignoredPaths`: List of XML element paths to ignore during formatting. \nThis can be a partial path (element tag name) or full path starting from the document element e.g. `['/html/head/script', 'pre']`.\n  - type: `string[]`\n  - default: `[]`\n- `indentation`: The value used for indentation.\n  - type: `string`\n  - default: `'    '`\n- `collapseContent`: True to keep content in the same line as the element. Only works if element contains at least one text node.\n  - type: `boolean`\n  - default: `false`\n- `lineSeparator`: Specify the line separator to use.\n  - type: `string`\n  - default: `\\r\\n`\n- `whiteSpaceAtEndOfSelfclosingTag`: True to end self-closing tags with a space e.g. `<tag />`.\n  - type: `boolean`\n  - default: `false`\n- `throwOnFailure`: Throw an error when XML fails to parse and get formatted otherwise the original XML is returned.\n  - type: `boolean`\n  - default: `true`\n- `forceSelfClosingEmptyTag`: True to force empty tags to be self-closing.\n  - type: `boolean`\n  - default: `false`\n\n### Usage:\n \n```js\nimport xmlFormat from 'xml-formatter';\n\nxmlFormat('<root><!-- content --><content><p>This is <b>some</b> content.</content></p>', {\n    indentation: '  ', \n    filter: (node) => node.type !== 'Comment', \n    collapseContent: true, \n    lineSeparator: '\\n'\n});\n\n```\n\n### Output:\n\n```xml\n<root>\n  <content>\n    <p>This is <b>some</b> content.</p>\n  </content>\n</root>\n```\n\n## Minify mode\n\n### Usage:\n\n```js\nimport xmlFormat from 'xml-formatter';\n\nconst xml = `\n<root>\n  <content>\n    <p>\n        This is <b>some</b> content.\n    </p>\n  </content>\n</root>`;\n\nxmlFormat.minify(xml, {\n    filter: (node) => node.type !== 'Comment',\n    collapseContent: true\n});\n\n```\n\n### Output:\n\n```xml\n<root><content><p>This is<b>some</b>content.</p></content></root>\n```\n\n## On The Browser\n\nThe code is transpiled using [Babel](https://babeljs.io/) with [@babel/preset-env](https://babeljs.io/docs/en/babel-preset-env) default values and bundled using [browserify](https://browserify.org/).\n\n### Using `require('xml-formatter')`\n\n### Page:\n \n```html\n<script type=\"text/javascript\" src=\"dist/browser/xml-formatter.js\"></script>\n```\n\n### Usage:\n \n```js\nconst xmlFormatter = require('xml-formatter');\n\nxmlFormat('<root><content><p xml:space=\"preserve\">This is <b>some</b> content.</content></p>');\n```\n\n### Using global function `xmlFormatter`\n\n### Page:\n\n```html\n<script type=\"text/javascript\" src=\"dist/browser/xml-formatter-singleton.js\"></script>\n```\n\n### Usage:\n\n```js\nxmlFormatter('<root><content><p xml:space=\"preserve\">This is <b>some</b> content.</content></p>');\n```\n\n### Output\n\n```xml\n<root>\n    <content>\n        <p xml:space=\"preserve\">This is <b>some</b> content.</p>\n    </content>\n</root>\n```\n\n## License\n\nMIT\n","publish_time":1603127684982,"_cnpm_publish_time":1603127684982,"dist-tags":{"latest":"3.7.0","rc-minify":"3.3.0-rc-minify.0"}}