2.2.0 • Published 1 year ago

xformatting v2.2.0

Weekly downloads
5
License
MIT
Repository
github
Last release
1 year ago

Installation

$ npm install -S xformatting

Usage

Synchronous

const { formatSync } = require('xformatting');

const xml = '<xformatting><code xml:space="preserve">var hello = "world"</code></xformatting>';
const formattedXml = formatSync(xml);
console.log(formattedXml);

Asynchronous

const { format } = require('xformatting');

const xml = '<xformatting><code xml:space="preserve">var hello = "world"</code></xformatting>';
format(xml).then((formattedXml) => {
	console.log(formattedXml);
});

Options

You can pass an options object to the methods as a second argument. In this table you will find all setting options:

NameTypeDefaultDescription
linebreakstring"\r\n"New line characters
indentationstring"\t"Characters for indentation
preserveSpaceAttributestring"xml:space"Attribute name for preserve space
preserveSpaceFnFunctionFunction to check if preserve space is active

License

MIT

2.2.0

1 year ago

1.5.1

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.5.0

3 years ago

1.4.0

3 years ago

1.3.0

4 years ago

1.2.0

5 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago