{"name":"xml-formatter","version":"3.3.0-rc-minify.0","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":"./dist/cjs/index.js","es2015":"./dist/esm/index.js","types":"./dist/types/index.d.ts","sideEffects":false,"scripts":{"lint":"eslint . --ext=js,ts","clean":"rm -rf ./dist","compile":"npm run clean && npm run lint && npm run compile:commonjs && npm run compile:esnext && npm run compile:types && npm run compile:browser","compile:commonjs":"tsc --module commonjs --outDir ./dist/cjs --noEmit false","compile:esnext":"tsc --module esnext --outDir ./dist/esm --noEmit false","compile:types":"tsc --emitDeclarationOnly --declaration --declarationMap --outDir ./dist/types --noEmit false","compile:browser":"mkdir -p ./dist/browser && npm run compile:browser:require && npm run compile:browser:singleton","compile:browser:require":"browserify -g [ babelify --presets [ @babel/preset-env ] ] -r ./dist/cjs/index.js:xml-formatter -o ./dist/browser/xml-formatter.js","compile:browser:singleton":"browserify -g [ babelify --presets [ @babel/preset-env ] ] -r ./dist/cjs/index.js:xml-formatter -o ./dist/browser/xml-formatter-singleton.js -s xmlFormatter","test":"mocha --require=ts-node/register --extension=ts --spec=test","prepublishOnly":"echo Please use publish.sh && exit 1"},"engines":{"node":">= 14"},"keywords":["xml","pretty","print","pretty-print","indent","parser","formatter","xml:space","preserve"],"dependencies":{"xml-parser-xo":"^4.0.3"},"devDependencies":{"@babel/core":"^7.15.8","@babel/preset-env":"^7.15.8","@types/chai":"^4.3.3","@types/glob":"^7.2.0","@types/mocha":"^7.0.2","@types/node":"^14.18.29","@typescript-eslint/eslint-plugin":"^5.37.0","@typescript-eslint/parser":"^5.37.0","babelify":"^10.0.0","browserify":"^17.0.0","chai":"^4.3.4","eslint":"^6.8.0","glob":"^7.1.7","mocha":"^10.2.0","ts-node":"^10.9.1","typescript":"^4.7.4"},"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(node) => boolean`) Function to filter out unwanted nodes by returning `false`.\n- `indentation` (String, default=`'    '`) The value used for indentation.\n- `collapseContent` (Boolean, default=`false`) True to keep content in the same line as the element. Only works if element contains at least one text node\n- `lineSeparator` (String, default=`\\r\\n`) Specify the line separator to use\n- `whiteSpaceAtEndOfSelfclosingTag` (Boolean, default=`false`) to either end ad self closing tag with `<tag/>` or `<tag />`\n- `throwOnFailure` (Boolean, default=`true`) Throw an error when XML fails to parse and get formatted otherwise the original XML is returned\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","readmeFilename":"README.md","gitHead":"f83990ed110440a4c8a0eba52aecce4ebd31010d","_id":"xml-formatter@3.3.0-rc-minify.0","_nodeVersion":"16.14.0","_npmVersion":"8.12.1","dist":{"integrity":"sha512-eqzDyl6vs2IfLPDgzE+y5aqXIgLDpugMKXCzIHUeEuW9FWeOLQrnMeQP0MA/SDSbmuS3122yaVvXMJt7sIDtVg==","shasum":"2d7d9bff579a864e654c2e8638db4a5e90dad128","tarball":"http://registry-npm.ywwl.com/xml-formatter/download/xml-formatter-3.3.0-rc-minify.0.tgz","fileCount":12,"unpackedSize":72428,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDT+OCV80Jgr0Egz0rv/9o/6hWn/K9S7GhN8pqSkEvY/wIgNQjeHxOwLxeLC5hpjEYiInekeVUad3kmZdilcPy+PJ0="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj9eQ7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqzpA//ZomDyUDYhrQNA7jR52ZPTLYASFjiNSfB8fq76O/WpzA1mbbd\r\ntrjUoHUxC0orpTaXWcYcVD4sR7BAixzHd/hYnq67h+z01eB0yniGA7kvEoj+\r\nXQFoK0/+/TCNS+QvtUqn4l4y/8C1fwCgXNjzCIqSdQ1VbOu7BNRUU1v4XSVk\r\nsRSKwTR1Y0jMZqEXwR84XbqkBYBMa+bzP0hslU/m+mRAscvKf6CIFGCP0BQ9\r\nAgTeYLvD6+KZuvW2klpze54FFWuMEGatCcevcdZNioQ28naimKvwHefpzaQl\r\nw9K2/bBxseqLzkhQb3DrA2hPZsU0twMCv4VwxoOYxehDPlryIddBmCco7Yle\r\njgARkgL1QENpdWAsHSGsHNyS5oiJfm3YsF1QaeigQn+4aRsg+QLzlcNgK8V5\r\nrtL/9xMlHFCwLes5olcfQu28snRscweAUofmWbPOcX9QlEhVzPtm55nr0Kz6\r\nf7W0atsgLoAQjM3oDZfVAvinF3mWxDAbRJyQKfgqZ2rijK761/0WAJ+GWmlM\r\nsQdEDDfCkVTuQ514ae5W2aMFeUkbL3DJdsz1F3MrolidxgMIxjFt5FUe0KAo\r\nWtDXO/ZiB3kj+QRwM2v5tryzR/Vp+E0XXRj0tg7prawoU6NVxs49d681pXAr\r\ntwMoB9+BeZnI3cQ80piqbWjMOp3ilotUl1g=\r\n=GCN9\r\n-----END PGP SIGNATURE-----\r\n","size":11463,"noattachment":false,"key":"/xml-formatter/-/xml-formatter-3.3.0-rc-minify.0.tgz"},"_npmUser":{"name":"chrisbottin","email":"chrisbottin@gmail.com"},"directories":{},"maintainers":[{"name":"chrisbottin","email":"chrisbottin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/xml-formatter_3.3.0-rc-minify.0_1677059130844_0.22108367001262064"},"_hasShrinkwrap":false,"publish_time":1677059131049,"_cnpm_publish_time":1677059131049,"dist-tags":{"latest":"3.7.0","rc-minify":"3.3.0-rc-minify.0"}}