{"name":"xml-formatter","version":"3.3.2","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"},"gitHead":"7ef7189cd8251da8d8148a9b7bfa79590b90dd7d","_id":"xml-formatter@3.3.2","_nodeVersion":"16.14.0","_npmVersion":"8.12.1","dist":{"integrity":"sha512-ld34F1b7+2UQGNkfsAV4MN3/b7cdUstyMj3XJhzKFasOPtMToVCkqmrNcmrRuSlPxgH1K9tXPkqr75gAT3ix2g==","shasum":"1b12a1cda796ad94821fadcc0237c9f8db7d5169","tarball":"http://registry-npm.ywwl.com/xml-formatter/download/xml-formatter-3.3.2.tgz","fileCount":13,"unpackedSize":72148,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIECjYBMP7j9Q1capX705DfGAKUZ7jh/3TZbVZB7/nllMAiBX7ldNzvZ5YYF9vRhviNvRXA4eqGSqTmYLU9xtZ3Lu6A=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkCMH1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqSFw//YRjNvuLiuqyY8CbBG6v6nvQweqcGV49oinIB+KlN5Z08nHlh\r\nnUHhGSoPno9YTylVOzsPDPZ4tY2QSz0NjS+2allOIgERz7gszkjyjb1lYUEI\r\ngi/hDcl1xXTzAHiE12HyzBf83vF2GI2rt/A9Crk2+mj5OYguMMVzmKwZtLjK\r\nP2JY1nba7GQdsTuPBhqCgCW3zs9AEZGeIzTKMw5O3AluZTs48tLIADYmDx1c\r\nUEkkKPCuWWJPip+auCPb6yD0DJ4RUi4LNpl5xLiwUTE2/qZ4XHWUAnJyiKbS\r\nS5HjYzX5SUQgvJXjiiWTTl4UKQAel+qlLOxnU4TUYgs3F/jOB28kAA4bh0+2\r\n9q1lvNoR8C0enRafcX79gKBJOLonNqEBodRhNo7TGtosharyR7Utgev+qJnI\r\nvRKdQE5L+/wQ7/jt+HaHt2qLwh4v1VKld1PtHK9sdE3ob/h5HcGFkCgLh5sG\r\nkOHsPwH1JaGGa2u0dHqF12sE/pzjg7oWAjWOYV1Jf5Y5X3U2MUfeKxKaWs1v\r\nTtZ8iDkdbrr+ssqfXwnaco7CH0eB61AnLRuNt3v+qkG+Ce/gN0OyU0Au4dnh\r\naQtorc+EFQxvE5EO/dtca+wWNgvouPXKkyZaCeebvRUkYbk5HBeNSVAq4t77\r\njMAdaGwJOkDXO11B6FKW1hoteH/mlUsBIaY=\r\n=TSte\r\n-----END PGP SIGNATURE-----\r\n","size":11105,"noattachment":false,"key":"/xml-formatter/-/xml-formatter-3.3.2.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.2_1678295541513_0.015900277177778754"},"_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":1678295541715,"_cnpm_publish_time":1678295541715,"dist-tags":{"latest":"3.7.0","rc-minify":"3.3.0-rc-minify.0"}}