JSPM

xml-but-prettier

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 404630
  • Score
    100M100P100Q183328F
  • License MIT

Beautifies XML documents by putting each tag and text node on their own line and correctly indents everything

Package Exports

  • xml-but-prettier

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (xml-but-prettier) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

XML, But Prettier

Build Status NPM version

This module is a fork of jonathanp/xml-beautifier.

This module beautifies XML documents by putting each tag and text node on their own line and correctly indenting everything.

Can be used e.g. if you're using React as a static page generator and (for some reason) need the generated HTML to be more human-readable.

Install

$ npm install --save xml-beautifier

Usage

The module's function signature is xmlButPrettier(xml:String, options:Object).

import xmlButPrettier from 'xml-but-prettier';

const xml = xmlButPrettier('<div><span>foo</span></div>');
console.log(xml); // => will output correctly indented elements

Options

  • indentor: a custom string to divide lines by
  • textNodesOnSameLine: compresses text nodes onto the same line as their containing tags

License

MIT.