New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

prettify-xml

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettify-xml

Pretty-print XML.

1.2.0
latest
Source
npm
Version published
Weekly downloads
199K
-8.2%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 20 Jun 2017

Did you know?

Socket

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