prettify-xml

1.2.0 • Public • Published

prettify-xml

Build Status Code Coverage version downloads MIT License PRs Welcome Commitizen friendly

Pretty print xml.

This is a small package that synchronously pretty prints XML/HTML.

Usage

const prettifyXml = require('prettify-xml')
 
const input = '<div><p>foo</p><p>bar</p></div>'
 
const expectedOutput = [
  '<div>',
  '  <p>foo</p>',
  '  <p>bar</p>',
  '</div>',
].join('\n')
 
const options = {indent: 2, newline: '\n'} // 2 spaces is default, newline defaults to require('os').EOL
const output = prettifyXml(input, options) // options is optional
 
assert(output === expectedOutput)

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.2.0
    57,097
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.2.0
    57,097
  • 1.1.0
    0
  • 1.0.1
    0
  • 1.0.0
    2

Package Sidebar

Install

npm i prettify-xml

Weekly Downloads

57,099

Version

1.2.0

License

MIT

Last publish

Collaborators

  • jonathanewerner