Socket
Socket
Sign inDemoInstall

prettify-xml

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettify-xml

Pretty-print XML.


Version published
Maintainers
1
Weekly downloads
58,210
increased by2.41%
Install size
6.82 kB

Weekly downloads

Readme

Source

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)

FAQs

Last updated on 20 Jun 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc