prettify-xml
Pretty-print XML.
Last updated 3 years ago by jonathanewerner .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install prettify-xml 
SYNC missed versions from official npm registry.

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)

Current Tags

  • 1.2.0                                ...           latest (3 years ago)

4 Versions

  • 1.2.0                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           4 years ago

Copyright 2014 - 2016 © taobao.org |